home *** CD-ROM | disk | FTP | other *** search
/ Computer Inter@ctive 16 / Computer Interactive cdrom 16 - dic 98.iso / zdnetit / content / LOADRUNR.ZIP / final.pas < prev    next >
Encoding:
Pascal/Delphi Source File  |  1998-07-02  |  61.3 KB  |  2,471 lines

  1. program load_runner;
  2. uses crt ,msgraph;
  3. var    speed ,wait ,level ,music ,comp    :integer;
  4.  
  5.     exit  ,die    :boolean;
  6.     code        :array[1..5] of string;
  7.     no        :array[1..5] of integer;        {level number}
  8.     vc        :_videoconfig;
  9.     a        :integer;
  10.     map        :array[0..19 ,2..22] of integer;
  11.  
  12.     manx ,many ,manact    :integer;    {man coordinate & data}
  13.     manfall        :boolean;
  14.     enax ,enay ,enaact    :integer;    {enemy A coordinate & data}
  15.     enafall ,enagold    :boolean;
  16.     enbx ,enby ,enbact    :integer;    {enemy B coordinate & data}
  17.     enbfall ,enbgold    :boolean;
  18.     encx ,ency ,encact    :integer;    {enemy C coordinate & data}
  19.     encfall ,encgold    :boolean;
  20.     doorx ,doory        :integer;    {the place that the enemy appear}
  21.  
  22.     goldrem ,live        :integer;
  23.     score                :longint;
  24.  
  25. procedure initialize;
  26.       begin
  27.           a:=_setvideomode(_maxresmode);
  28.           _getvideoconfig(vc);
  29.           _clearscreen(_gclearscreen);
  30.  
  31.           music:=0;     {Sound on if 0 ,sound off if 1}
  32.           comp:=1;        {Computer is 386 or 486 if 0 ,586 or upper is 1}
  33.           speed:=2;        {guard speed}
  34.           wait:=2;         {delay time}
  35.           level:=1;        {level play in game}
  36.           exit:=false;     {exit the game if true}
  37.           die:=true;       {die will occur if true}
  38.  
  39.           manact:=1;
  40.           enaact:=0;
  41.           enbact:=0;
  42.           encact:=0;
  43.           manfall:=false;
  44.           enafall:=false;enagold:=false;
  45.           enbfall:=false;enbgold:=false;
  46.           encfall:=false;encgold:=false;
  47.  
  48.           goldrem:=0;
  49.           score:=0;
  50.           live:=2;
  51.  
  52.           randomize;
  53.     end;
  54.  
  55. procedure beep(temp    :integer);
  56.     var    time ,p    :longint;
  57.     begin
  58.         if music=0 then begin
  59.             case temp of    {given sound}
  60.             1    :    sound(600);    {man moving}
  61.             2    :    sound(700);    {man climbing ladder}
  62.             3    :    sound(800);    {man climbing wire}
  63.             4    :    sound(900);    {man falling}
  64.             5    :    sound(350);    {man breaking}
  65.             6    :    sound(1500);    {man get a gold}
  66.             7    :    sound(2000);    {man die}
  67.  
  68.             8    :    sound(1000);    {enemy fall}
  69.             9    :    sound(300);    {enemy die}
  70.             end;
  71.             if (temp=6) or (temp=7) or (temp=9)
  72.                 then time:=100000
  73.                 else time:=60000;    {delay time}
  74.             if comp=0 then time:=time div 10;
  75.             for p:=1 to time do;
  76.             nosound;
  77.             end;
  78.     end;
  79.  
  80. procedure readcode;
  81.       var codefile  :text;
  82.          p         :integer;    {count order of the level}
  83.       begin
  84.           assign(codefile ,'code.dat');
  85.           reset(codefile);
  86.           for p:=1 to 6 do begin
  87.             readln(codefile ,code[p]);
  88.             readln(codefile ,no[p]);
  89.           end;
  90.           close(codefile);
  91.       end;
  92.  
  93. {start game procedure}
  94.     {wallpaper object :brick ,gold ,ladder ,wire}
  95.         {brick}
  96. procedure brick(x ,y    :integer);
  97.     var     ran    :integer;
  98.     begin
  99.         ran:=round(random);
  100.         x:=x*32;
  101.         y:=y*20;
  102.         _setcolor(6);
  103.         _rectangle(_gfillinterior ,x ,y ,x+32 ,y+20);
  104.         if ran=1 then begin
  105.             _setcolor(7);
  106.             _moveto(x ,y+13);
  107.             _lineto(x+20 ,y+13);
  108.             _moveto(x+20 ,y);
  109.             _lineto(x+20 ,y+20);
  110.             _moveto(x+20 ,y+7);
  111.             _lineto(x+32 ,y+7);
  112.         end
  113.         else begin
  114.             _setcolor(7);
  115.             _moveto(x ,y+10);
  116.             _lineto(x+32 ,y+10);
  117.             _moveto(x+10 ,y+10);
  118.             _lineto(x+10 ,y);
  119.             _moveto(x+20 ,y+10);
  120.             _lineto(x+20 ,y+20);
  121.         end;
  122.         _setcolor(7);
  123.         _rectangle(_gborder ,x ,y ,x+32 ,y+20);
  124.  
  125.     end;
  126.  
  127.         {gold}
  128. procedure gold(x ,y    :integer);
  129.     begin
  130.         x:=x*32;
  131.         y:=y*20;
  132.             _setcolor(14);
  133.             _moveto(x+1  ,y+19);
  134.             _lineto(x+15 ,y+19);
  135.             _lineto(x+7  ,y+5);
  136.             _lineto(x+1  ,y+19);
  137.             _floodfill(x+8 ,y+10 ,14);
  138.             _moveto(x+15 ,y+19);
  139.             _lineto(x+30 ,y+19);
  140.             _lineto(x+22 ,y+5);
  141.             _lineto(x+15 ,y+19);
  142.             _floodfill(x+23 ,y+10 ,14);
  143.     end;
  144.  
  145.         {wire}
  146. procedure wire(x ,y    :integer);
  147.     begin
  148.         x:=x*32;
  149.         y:=y*20;
  150.         _setcolor(11);
  151.         _moveto(x ,y+2);
  152.         _lineto(x+32 ,y+2);
  153.     end;
  154.  
  155.         {ladder}
  156. procedure ladder(x ,y    :integer);
  157.     begin
  158.         x:=x*32;
  159.         y:=y*20;
  160.         _setcolor(10);
  161.         _moveto(x+9 ,y);
  162.         _lineto(x+9 ,y+20);
  163.         _moveto(x+20 ,y);
  164.         _lineto(x+20 ,y+20);
  165.         _moveto(x+9 ,y+6);
  166.         _lineto(x+20 ,y+6);
  167.         _moveto(x+9 ,y+15);
  168.         _lineto(x+20 ,y+15);
  169.     end;
  170.     {ending wallpaper object}
  171.  
  172.     {man :man ,climan ,wcliman ,wireman ,fallman ,break}
  173.         {walking man}
  174. procedure man(x ,y ,action    :integer);
  175.     begin
  176.         x:=x*32;
  177.         y:=y*20;
  178.         _setcolor(15);
  179.         _moveto(x+15 ,y+5 );
  180.         _lineto(x+15 ,y+15);
  181.         {orginal}
  182.         if action=1 then begin
  183.             _setcolor(15);
  184.             _moveto(x+15 ,y+15);
  185.             _lineto(x+12 ,y+15);
  186.             _lineto(x+12 ,y+19);
  187.             _moveto(x+15 ,y+15);
  188.             _lineto(x+18 ,y+15);
  189.             _lineto(x+18 ,y+19);
  190.             _moveto(x+15 ,y+10);
  191.             _lineto(x+10 ,y+12);
  192.             _lineto(x+8  ,y+14);
  193.             _moveto(x+15 ,y+10);
  194.             _lineto(x+20 ,y+12);
  195.             _lineto(x+22 ,y+14);
  196.             _setcolor(12);
  197.             _ellipse(_gfillinterior ,x+7  ,y+13 ,x+9  ,y+14);
  198.             _ellipse(_gfillinterior ,x+21 ,y+13 ,x+23 ,y+14);
  199.         end
  200.         {left}
  201.         else if action=0 then begin
  202.             _setcolor(15);
  203.             _moveto(x+15 ,y+15);
  204.             _lineto(x+20 ,y+19);
  205.             _moveto(x+15 ,y+15);
  206.             _lineto(x+12 ,y+17);
  207.             _lineto(x+15 ,y+19);
  208.             _moveto(x+15 ,y+10);
  209.             _lineto(x+13 ,y+12);
  210.             _moveto(x+15 ,y+10);
  211.             _lineto(x+20 ,y+16);
  212.             _setcolor(12);
  213.             _ellipse(_gfillinterior ,x+12 ,y+11 ,x+14 ,y+13);
  214.             _ellipse(_gfillinterior ,x+19 ,y+15 ,x+21 ,y+17);
  215.         end
  216.         {right}
  217.         else if action=2 then begin
  218.             _setcolor(15);
  219.             _moveto(x+15 ,y+15);
  220.             _lineto(x+10 ,y+19);
  221.             _moveto(x+15 ,y+15);
  222.             _lineto(x+17 ,y+17);
  223.             _lineto(x+15 ,y+19);
  224.             _moveto(x+15 ,y+10);
  225.             _lineto(x+18 ,y+12);
  226.             _moveto(x+15 ,y+10);
  227.             _lineto(x+10 ,y+16);
  228.             _setcolor(12);
  229.             _ellipse(_gfillinterior ,x+17 ,y+11 ,x+19 ,y+13);
  230.             _ellipse(_gfillinterior ,x+9  ,y+15 ,x+11 ,y+17);
  231.         end;
  232.         _setcolor(14);
  233.         _ellipse(_gfillinterior ,x+12 ,y+1 ,x+19 ,y+8);
  234.     end;
  235.  
  236.         {walking man under ladder}
  237. procedure wcliman(x ,y ,action    :integer);
  238.     begin
  239.         ladder(x ,y);
  240.         x:=x*32;
  241.         y:=y*20;
  242.         {walk climb  man}
  243.         _setcolor(15);
  244.         _moveto(x+15 ,y+5 );
  245.         _lineto(x+15 ,y+15);
  246.         {orginal}
  247.         if action=1 then begin
  248.             _setcolor(15);
  249.             _moveto(x+15 ,y+15);
  250.             _lineto(x+12 ,y+15);
  251.             _lineto(x+12 ,y+19);
  252.             _moveto(x+15 ,y+15);
  253.             _lineto(x+18 ,y+15);
  254.             _lineto(x+18 ,y+19);
  255.             _moveto(x+15 ,y+10);
  256.             _lineto(x+10 ,y+12);
  257.             _lineto(x+8  ,y+14);
  258.             _moveto(x+15 ,y+10);
  259.             _lineto(x+20 ,y+12);
  260.             _lineto(x+22 ,y+14);
  261.             _setcolor(12);
  262.             _ellipse(_gfillinterior ,x+7  ,y+13 ,x+9  ,y+14);
  263.             _ellipse(_gfillinterior ,x+21 ,y+13 ,x+23 ,y+14);
  264.         end
  265.         {left}
  266.         else if action=0 then begin
  267.             _setcolor(15);
  268.             _moveto(x+15 ,y+15);
  269.             _lineto(x+20 ,y+19);
  270.             _moveto(x+15 ,y+15);
  271.             _lineto(x+12 ,y+17);
  272.             _lineto(x+15 ,y+19);
  273.             _moveto(x+15 ,y+10);
  274.             _lineto(x+13 ,y+12);
  275.             _moveto(x+15 ,y+10);
  276.             _lineto(x+20 ,y+16);
  277.             _setcolor(12);
  278.             _ellipse(_gfillinterior ,x+12 ,y+11 ,x+14 ,y+13);
  279.             _ellipse(_gfillinterior ,x+19 ,y+15 ,x+21 ,y+17);
  280.         end
  281.         {right}
  282.         else if action=2 then begin
  283.             _setcolor(15);
  284.             _moveto(x+15 ,y+15);
  285.             _lineto(x+10 ,y+19);
  286.             _moveto(x+15 ,y+15);
  287.             _lineto(x+17 ,y+17);
  288.             _lineto(x+15 ,y+19);
  289.             _moveto(x+15 ,y+10);
  290.             _lineto(x+18 ,y+12);
  291.             _moveto(x+15 ,y+10);
  292.             _lineto(x+10 ,y+16);
  293.             _setcolor(12);
  294.             _ellipse(_gfillinterior ,x+17 ,y+11 ,x+19 ,y+13);
  295.             _ellipse(_gfillinterior ,x+9  ,y+15 ,x+11 ,y+17);
  296.         end;
  297.         _setcolor(14);
  298.         _ellipse(_gfillinterior ,x+12 ,y+1 ,x+19 ,y+8);
  299.     end;
  300.  
  301.         {Climbing ladder man}
  302. procedure climan(x ,y ,action    :integer);
  303.     begin
  304.         ladder(x ,y);
  305.         x:=x*32;
  306.         y:=y*20;
  307.         {climbing man}
  308.         _setcolor(15);
  309.         _moveto(x+15 ,y+5 );
  310.         _lineto(x+15 ,y+15);
  311.         {orginal}
  312.         if action=1 then begin
  313.             _setcolor(15);
  314.             _moveto(x+15 ,y+15);
  315.             _lineto(x+11 ,y+11);
  316.             _lineto(x+11 ,y+15);
  317.             _moveto(x+15 ,y+15);
  318.             _lineto(x+18 ,y+17);
  319.             _lineto(x+18 ,y+19);
  320.             _moveto(x+15 ,y+10);
  321.             _lineto(x+10 ,y+8);
  322.             _lineto(x+10  ,y+3);
  323.             _moveto(x+15 ,y+12);
  324.             _lineto(x+20 ,y+12);
  325.             _lineto(x+20 ,y+7);
  326.             _setcolor(12);
  327.             _ellipse(_gfillinterior ,x+9  ,y+2 ,x+11  ,y+4);
  328.             _ellipse(_gfillinterior ,x+19 ,y+6 ,x+21 ,y+8);
  329.             end
  330.         {climbing}
  331.         else begin
  332.             _setcolor(15);
  333.             _moveto(x+15 ,y+15);
  334.             _lineto(x+18 ,y+11);
  335.             _lineto(x+18 ,y+15);
  336.             _moveto(x+15 ,y+15);
  337.             _lineto(x+11 ,y+17);
  338.             _lineto(x+11 ,y+19);
  339.             _moveto(x+15 ,y+10);
  340.             _lineto(x+20 ,y+8);
  341.             _lineto(x+20 ,y+3);
  342.             _moveto(x+15 ,y+12);
  343.             _lineto(x+10 ,y+12);
  344.             _lineto(x+10 ,y+7);
  345.             _setcolor(12);
  346.             _ellipse(_gfillinterior ,x+9  ,y+6 ,x+11  ,y+8);
  347.             _ellipse(_gfillinterior ,x+19 ,y+2 ,x+21 ,y+4);
  348.         end;
  349.         _setcolor(14);
  350.         _ellipse(_gfillinterior ,x+12 ,y+1 ,x+19 ,y+8);
  351.     end;
  352.  
  353.         {Climbing wire man}
  354. procedure wireman(x ,y ,action    :integer);
  355.     begin
  356.         x:=x*32;
  357.         y:=y*20;
  358.         _setcolor(15);
  359.         _moveto(x+15 ,y+5 );
  360.         _lineto(x+15 ,y+15);
  361.         {orginal}
  362.         if action=1 then begin
  363.             _setcolor(15);
  364.             _moveto(x+15 ,y+15);
  365.             _lineto(x+13 ,y+15);
  366.             _lineto(x+13 ,y+19);
  367.             _moveto(x+15 ,y+15);
  368.             _lineto(x+18 ,y+15);
  369.             _lineto(x+18 ,y+19);
  370.             _moveto(x+15 ,y+10);
  371.             _lineto(x+10 ,y+10);
  372.             _lineto(x+7  ,y+2);
  373.             _moveto(x+15 ,y+10);
  374.             _lineto(x+20 ,y+10);
  375.             _lineto(x+23 ,y+2);
  376.             _setcolor(12);
  377.             _ellipse(_gfillinterior ,x+6  ,y+1 ,x+8  ,y+3);
  378.             _ellipse(_gfillinterior ,x+22 ,y+1 ,x+24 ,y+3);
  379.         end
  380.         {climbing wire}
  381.         else begin
  382.             _setcolor(15);
  383.             _moveto(x+15 ,y+15);
  384.             _lineto(x+13 ,y+15);
  385.             _lineto(x+12 ,y+19);
  386.             _moveto(x+15 ,y+15);
  387.             _lineto(x+18 ,y+15);
  388.             _lineto(x+19 ,y+19);
  389.             _moveto(x+15 ,y+10);
  390.             _lineto(x+10 ,y+10);
  391.             _lineto(x+12  ,y+2);
  392.             _moveto(x+15 ,y+10);
  393.             _lineto(x+20 ,y+10);
  394.             _lineto(x+18 ,y+2);
  395.             _setcolor(12);
  396.             _ellipse(_gfillinterior ,x+11  ,y+1 ,x+13  ,y+3);
  397.             _ellipse(_gfillinterior ,x+17 ,y+1 ,x+19 ,y+3);
  398.         end;
  399.         _setcolor(14);
  400.         _ellipse(_gfillinterior ,x+12 ,y+1 ,x+19 ,y+8);
  401.     end;
  402.  
  403.         {falling down man}
  404. procedure fallman(x ,y    :integer);
  405.     begin
  406.         x:=x*32;
  407.         y:=y*20;
  408.         _setcolor(15);
  409.         _moveto(x+15 ,y+5 );
  410.         _lineto(x+15 ,y+15);
  411.         _lineto(x+13 ,y+17);
  412.         _lineto(x+10 ,y+14);
  413.         _moveto(x+15 ,y+15);
  414.         _lineto(x+18 ,y+17);
  415.         _lineto(x+20 ,y+14);
  416.         _moveto(x+15 ,y+10);
  417.         _lineto(x+9  ,y+4 );
  418.         _moveto(x+15 ,y+10);
  419.         _lineto(x+21 ,y+4);
  420.         _setcolor(12);
  421.         _ellipse(_gfillinterior ,x+8  ,y+3 ,x+10 ,y+5);
  422.         _ellipse(_gfillinterior ,x+20 ,y+3 ,x+22 ,y+5);
  423.         _setcolor(14);
  424.         _ellipse(_gfillinterior ,x+12 ,y+1 ,x+19 ,y+8);
  425.     end;
  426.  
  427.         {breaking brick man}
  428.  
  429. procedure break(x ,y ,action    :integer);
  430.     begin
  431.         x:=x*32;
  432.         y:=y*20;
  433.         {left}
  434.         if action=1 then begin    {break left brick on brick}
  435.             _setcolor(15);
  436.             _moveto(x+10 ,y+10);
  437.             _lineto(x+15 ,y+15);
  438.  
  439.             _lineto(x+12 ,y+17);
  440.             _lineto(x+15 ,y+19);
  441.             _moveto(x+15 ,y+15);
  442.             _lineto(x+20 ,y+19);
  443.  
  444.             _moveto(x+12 ,y+12);
  445.             _lineto(x+3  ,y+17);
  446.             _moveto(x+12 ,y+12);
  447.             _lineto(x+15 ,y+10);
  448.             _lineto(x+20 ,y+15);
  449.             _setcolor(12);
  450.             _ellipse(_gfillinterior ,x+19 ,y+14 ,x+21 ,y+16);
  451.             _ellipse(_gfillinterior ,x+1  ,y+15 ,x+5 ,y+19);
  452.             _setcolor(14);
  453.             _ellipse(_gfillinterior ,x+6 ,y+6 ,x+10 ,y+10);
  454.         end
  455.         else if action=2 then begin    {break right brick on brick}
  456.             _setcolor(15);
  457.             _moveto(x+15 ,y+10);
  458.             _lineto(x+10 ,y+15);
  459.  
  460.             _lineto(x+13 ,y+17);
  461.             _lineto(x+10 ,y+19);
  462.             _moveto(x+10 ,y+15);
  463.             _lineto(x+5  ,y+19);
  464.  
  465.             _moveto(x+13 ,y+12);
  466.             _lineto(x+23 ,y+17);
  467.             _moveto(x+13 ,y+12);
  468.             _lineto(x+10 ,y+10);
  469.             _lineto(x+5  ,y+15);
  470.             _setcolor(12);
  471.             _ellipse(_gfillinterior ,x+4  ,y+14 ,x+6  ,y+16);
  472.             _ellipse(_gfillinterior ,x+21 ,y+15 ,x+25 ,y+19);
  473.             _setcolor(14);
  474.             _ellipse(_gfillinterior ,x+19 ,y+6  ,x+15 ,y+10);
  475.         end
  476.         else if action=3 then begin    {break left brick on ladder}
  477.             ladder(x div 32 ,y div 20);
  478.             _setcolor(15);
  479.             _moveto(x+10 ,y+10);
  480.             _lineto(x+15 ,y+15);
  481.  
  482.             _lineto(x+12 ,y+17);
  483.             _lineto(x+15 ,y+19);
  484.             _moveto(x+15 ,y+15);
  485.             _lineto(x+20 ,y+19);
  486.  
  487.             _moveto(x+12 ,y+12);
  488.             _lineto(x+3  ,y+17);
  489.             _moveto(x+12 ,y+12);
  490.             _lineto(x+15 ,y+10);
  491.             _lineto(x+20 ,y+5);
  492.             _setcolor(12);
  493.             _ellipse(_gfillinterior ,x+19 ,y+4  ,x+21 ,y+6);
  494.             _ellipse(_gfillinterior ,x+1  ,y+15 ,x+5  ,y+19);
  495.             _setcolor(14);
  496.             _ellipse(_gfillinterior ,x+6 ,y+6 ,x+10 ,y+10);
  497.         end
  498.         else if action=4 then begin    {break right brick on ladder}
  499.             ladder(x div 32 ,y div 20);
  500.             _setcolor(15);
  501.             _moveto(x+15 ,y+10);
  502.             _lineto(x+10 ,y+15);
  503.  
  504.             _lineto(x+13 ,y+17);
  505.             _lineto(x+10 ,y+19);
  506.             _moveto(x+10 ,y+15);
  507.             _lineto(x+5  ,y+19);
  508.  
  509.             _moveto(x+13 ,y+12);
  510.             _lineto(x+23 ,y+17);
  511.             _moveto(x+13 ,y+12);
  512.             _lineto(x+10 ,y+10);
  513.             _lineto(x+9  ,y+5);
  514.             _setcolor(12);
  515.             _ellipse(_gfillinterior ,x+8  ,y+4  ,x+10  ,y+6);
  516.             _ellipse(_gfillinterior ,x+21 ,y+15 ,x+25 ,y+19);
  517.             _setcolor(14);
  518.             _ellipse(_gfillinterior ,x+19 ,y+6  ,x+15 ,y+10);
  519.         end
  520.         else if action=5 then begin    {break left brick on the wire}
  521.             wire(x div 32 ,y div 20);
  522.             _setcolor(15);
  523.             _moveto(x+10 ,y+10);
  524.             _lineto(x+15 ,y+15);
  525.  
  526.             _lineto(x+12 ,y+17);
  527.             _lineto(x+15 ,y+19);
  528.             _moveto(x+15 ,y+15);
  529.             _lineto(x+20 ,y+19);
  530.  
  531.             _moveto(x+12 ,y+12);
  532.             _lineto(x+3  ,y+17);
  533.             _moveto(x+12 ,y+12);
  534.             _lineto(x+15 ,y+10);
  535.             _lineto(x+20 ,y+2);
  536.             _setcolor(12);
  537.             _ellipse(_gfillinterior ,x+19 ,y+1  ,x+21 ,y+3);
  538.             _ellipse(_gfillinterior ,x+1  ,y+15 ,x+5  ,y+19);
  539.             _setcolor(14);
  540.             _ellipse(_gfillinterior ,x+6 ,y+6 ,x+10 ,y+10);
  541.         end
  542.         else if action=6 then begin    {break right brick on the wire}
  543.             wire(x div 32 ,y div 20);
  544.             _setcolor(15);
  545.             _moveto(x+15 ,y+10);
  546.             _lineto(x+10 ,y+15);
  547.  
  548.             _lineto(x+13 ,y+17);
  549.             _lineto(x+10 ,y+19);
  550.             _moveto(x+10 ,y+15);
  551.             _lineto(x+5  ,y+19);
  552.  
  553.             _moveto(x+13 ,y+12);
  554.             _lineto(x+23 ,y+17);
  555.             _moveto(x+13 ,y+12);
  556.             _lineto(x+10 ,y+10);
  557.             _lineto(x+5  ,y+2);
  558.             _setcolor(12);
  559.             _ellipse(_gfillinterior ,x+4  ,y+1  ,x+6  ,y+3);
  560.             _ellipse(_gfillinterior ,x+21 ,y+15 ,x+25 ,y+19);
  561.             _setcolor(14);
  562.             _ellipse(_gfillinterior ,x+19 ,y+6  ,x+15 ,y+10);
  563.         end
  564.     end;
  565.     {ending of man}
  566.  
  567.     {enemy :enemy ,wclienemy ,clienemy ,wireenemy ,fallenemy ,brickenemy}
  568.         {walking enemy}
  569. procedure enemy(x ,y ,action    :integer);
  570.     begin
  571.         x:=x*32;
  572.         y:=y*20;
  573.         _setcolor(14);
  574.         _moveto(x+15 ,y+5 );
  575.         _lineto(x+15 ,y+15);
  576.         {orginal}
  577.         if action=1 then begin
  578.             _setcolor(11);
  579.             _moveto(x+15 ,y+15);
  580.             _lineto(x+12 ,y+15);
  581.             _lineto(x+12 ,y+19);
  582.             _moveto(x+15 ,y+15);
  583.             _lineto(x+18 ,y+15);
  584.             _lineto(x+18 ,y+19);
  585.             _moveto(x+15 ,y+10);
  586.             _lineto(x+10 ,y+8);
  587.             _lineto(x+8  ,y+6);
  588.             _moveto(x+15 ,y+10);
  589.             _lineto(x+20 ,y+8);
  590.             _lineto(x+22 ,y+6);
  591.             _setcolor(10);
  592.         end
  593.         {left}
  594.         else if action=0 then begin
  595.             _setcolor(11);
  596.             _moveto(x+15 ,y+15);
  597.             _lineto(x+20 ,y+19);
  598.             _moveto(x+15 ,y+15);
  599.             _lineto(x+12 ,y+17);
  600.             _lineto(x+15 ,y+19);
  601.             _moveto(x+15 ,y+10);
  602.             _lineto(x+13 ,y+8);
  603.             _moveto(x+15 ,y+10);
  604.             _lineto(x+20 ,y+4);
  605.             _setcolor(10);
  606.         end
  607.         {right}
  608.         else if action=2 then begin
  609.             _setcolor(11);
  610.             _moveto(x+15 ,y+15);
  611.             _lineto(x+10 ,y+19);
  612.             _moveto(x+15 ,y+15);
  613.             _lineto(x+17 ,y+17);
  614.             _lineto(x+15 ,y+19);
  615.             _moveto(x+15 ,y+10);
  616.             _lineto(x+18 ,y+8);
  617.             _moveto(x+15 ,y+10);
  618.             _lineto(x+10 ,y+4);
  619.             _setcolor(10);
  620.         end;
  621.         _setcolor(12);
  622.         _ellipse(_gfillinterior ,x+12 ,y+1 ,x+19 ,y+8);
  623.     end;
  624.         {walking man under ladder}
  625. procedure wclienemy(x ,y ,action    :integer);
  626.     begin
  627.         ladder(x ,y);
  628.         x:=x*32;
  629.         y:=y*20;
  630.         {walk climb man}
  631.         _setcolor(14);
  632.         _moveto(x+15 ,y+5 );
  633.         _lineto(x+15 ,y+15);
  634.         {orginal}
  635.         if action=1 then begin
  636.             _setcolor(11);
  637.             _moveto(x+15 ,y+15);
  638.             _lineto(x+12 ,y+15);
  639.             _lineto(x+12 ,y+19);
  640.             _moveto(x+15 ,y+15);
  641.             _lineto(x+18 ,y+15);
  642.             _lineto(x+18 ,y+19);
  643.             _moveto(x+15 ,y+10);
  644.             _lineto(x+10 ,y+8);
  645.             _lineto(x+8  ,y+6);
  646.             _moveto(x+15 ,y+10);
  647.             _lineto(x+20 ,y+8);
  648.             _lineto(x+22 ,y+6);
  649.             _setcolor(10);
  650.         end
  651.         {left}
  652.         else if action=0 then begin
  653.             _setcolor(11);
  654.             _moveto(x+15 ,y+15);
  655.             _lineto(x+20 ,y+19);
  656.             _moveto(x+15 ,y+15);
  657.             _lineto(x+12 ,y+17);
  658.             _lineto(x+15 ,y+19);
  659.             _moveto(x+15 ,y+10);
  660.             _lineto(x+13 ,y+8);
  661.             _moveto(x+15 ,y+10);
  662.             _lineto(x+20 ,y+4);
  663.             _setcolor(10);
  664.         end
  665.         {right}
  666.         else if action=2 then begin
  667.             _setcolor(11);
  668.             _moveto(x+15 ,y+15);
  669.             _lineto(x+10 ,y+19);
  670.             _moveto(x+15 ,y+15);
  671.             _lineto(x+17 ,y+17);
  672.             _lineto(x+15 ,y+19);
  673.             _moveto(x+15 ,y+10);
  674.             _lineto(x+18 ,y+8);
  675.             _moveto(x+15 ,y+10);
  676.             _lineto(x+10 ,y+4);
  677.             _setcolor(10);
  678.         end;
  679.         _setcolor(12);
  680.         _ellipse(_gfillinterior ,x+12 ,y+1 ,x+19 ,y+8);
  681.     end;
  682.  
  683.  
  684.         {climbing ladder enemy}
  685. procedure clienemy(x ,y ,action    :integer);
  686.     begin
  687.         ladder(x ,y);
  688.         x:=x*32;
  689.         y:=y*20;
  690.         {climbing man}
  691.         _setcolor(14);
  692.         _moveto(x+15 ,y+5 );
  693.         _lineto(x+15 ,y+15);
  694.         {orginal}
  695.         if action=1 then begin
  696.             _setcolor(11);
  697.             _moveto(x+15 ,y+15);
  698.             _lineto(x+10 ,y+17);
  699.             _moveto(x+15 ,y+15);
  700.             _lineto(x+20 ,y+13);
  701.             _moveto(x+15 ,y+10);
  702.             _lineto(x+10 ,y+6);
  703.             _lineto(x+10  ,y+2);
  704.             _moveto(x+15 ,y+12);
  705.             _lineto(x+20 ,y+8);
  706.             _lineto(x+20 ,y+4);
  707.             _setcolor(10);
  708.         end
  709.         {climbing}
  710.         else begin
  711.             _setcolor(11);
  712.             _moveto(x+15 ,y+15);
  713.             _lineto(x+20 ,y+17);
  714.             _moveto(x+15 ,y+15);
  715.             _lineto(x+10 ,y+13);
  716.             _moveto(x+15 ,y+10);
  717.             _lineto(x+20 ,y+6);
  718.             _lineto(x+20 ,y+2);
  719.             _moveto(x+15 ,y+12);
  720.             _lineto(x+10 ,y+8);
  721.             _lineto(x+10 ,y+5);
  722.             _setcolor(10);
  723.         end;
  724.         _setcolor(12);
  725.         _ellipse(_gfillinterior ,x+12 ,y+1 ,x+19 ,y+8);
  726.     end;
  727.  
  728.  
  729.         {climbing wire enemy}
  730. procedure wireenemy(x ,y ,action    :integer);
  731.     begin
  732.         x:=x*32;
  733.         y:=y*20;
  734.         _setcolor(14);
  735.         _moveto(x+15 ,y+5 );
  736.         _lineto(x+15 ,y+15);
  737.         {orginal}
  738.         if action=1 then begin
  739.             _setcolor(11);
  740.             _moveto(x+15 ,y+15);
  741.             _lineto(x+13 ,y+15);
  742.             _lineto(x+15 ,y+19);
  743.             _moveto(x+15 ,y+15);
  744.             _lineto(x+17 ,y+15);
  745.             _lineto(x+15 ,y+19);
  746.             _moveto(x+15 ,y+10);
  747.             _lineto(x+10 ,y+10);
  748.             _lineto(x+15 ,y+2);
  749.             _moveto(x+15 ,y+10);
  750.             _lineto(x+20 ,y+10);
  751.             _lineto(x+15 ,y+2);
  752.         end
  753.         {climbing wire}
  754.         else begin
  755.             _setcolor(11);
  756.             _moveto(x+15 ,y+15);
  757.             _lineto(x+13 ,y+15);
  758.             _lineto(x+8  ,y+19);
  759.             _moveto(x+15 ,y+15);
  760.             _lineto(x+18 ,y+15);
  761.             _lineto(x+23 ,y+19);
  762.             _moveto(x+15 ,y+10);
  763.             _lineto(x+10 ,y+10);
  764.             _lineto(x+7  ,y+2);
  765.             _moveto(x+15 ,y+10);
  766.             _lineto(x+20 ,y+10);
  767.             _lineto(x+23 ,y+2);
  768.         end;
  769.         _setcolor(12);
  770.         _ellipse(_gfillinterior ,x+12 ,y+1 ,x+19 ,y+8);
  771.     end;
  772.  
  773.     {falling down enemy}
  774. procedure fallenemy(x ,y    :integer);
  775.     begin
  776.         x:=x*32;
  777.         y:=y*20;
  778.         _setcolor(14);
  779.         _moveto(x+15 ,y+5 );
  780.         _lineto(x+15 ,y+15);
  781.         _setcolor(11);
  782.         _lineto(x+12 ,y+15);
  783.         _lineto(x+10  ,y+11);
  784.         _moveto(x+15 ,y+15);
  785.         _lineto(x+18 ,y+15);
  786.         _lineto(x+20 ,y+11);
  787.         _moveto(x+15 ,y+10);
  788.         _lineto(x+10 ,y+7);
  789.         _lineto(x+9  ,y+3 );
  790.         _moveto(x+15 ,y+10);
  791.         _lineto(x+20 ,y+7);
  792.         _lineto(x+21 ,y+3);
  793.         _setcolor(12);
  794.         _ellipse(_gfillinterior ,x+12 ,y+1 ,x+19 ,y+8);
  795.     end;
  796.  
  797.     {falling in break brick enemy}
  798. procedure brickenemy(x ,y    :integer);
  799.     begin
  800.         x:=x*32;
  801.         y:=y*20;
  802.         _setcolor(14);
  803.         _moveto(x+15 ,y+5 );
  804.         _lineto(x+15 ,y+15);
  805.         _setcolor(11);
  806.         _lineto(x+12 ,y+15);
  807.         _lineto(x+1  ,y+17);
  808.         _lineto(x+1  ,y+13);
  809.         _moveto(x+15 ,y+15);
  810.         _lineto(x+18 ,y+15);
  811.         _lineto(x+31 ,y+17);
  812.         _lineto(x+31 ,y+13);
  813.         _moveto(x+15 ,y+10);
  814.         _lineto(x+10 ,y+7);
  815.         _lineto(x+1  ,y+3 );
  816.         _moveto(x+15 ,y+10);
  817.         _lineto(x+20 ,y+7);
  818.         _lineto(x+32 ,y+3);
  819.         _setcolor(12);
  820.         _ellipse(_gfillinterior ,x+12 ,y+1 ,x+19 ,y+8);
  821.     end;
  822.     {ending of enemy}
  823.  
  824.     {mapping :readmap ,drawmap ,clear ,breakclear ,redraw ,refresh ,textprint ,showcode}
  825.         {read map}
  826. procedure readmap;
  827.     var    mfile            :text;
  828.         symbol            :integer;
  829.         m ,n            :integer;
  830.         tempcode ,data    :string;
  831.         coordinate        :string;
  832.     begin
  833.         case level of
  834.         1    :    assign(mfile ,'map1.map');
  835.         2    :    assign(mfile ,'map2.map');
  836.         3    :    assign(mfile ,'map3.map');
  837.         4    :    assign(mfile ,'map4.map');
  838.         5    :    assign(mfile ,'map5.map');
  839.         end;
  840.         reset(mfile);
  841.         goldrem:=0;
  842.         for n:=2 to 22 do begin
  843.             for m:=1 to 20 do begin
  844.                 map[m-1 ,n]:=0;
  845.                 end;
  846.             end;
  847.         for n:=2 to 22 do begin
  848.             data:='';
  849.             readln(mfile ,data);
  850.             for m:=1 to 20 do begin
  851.                 tempcode:='';
  852.                 tempcode:=copy(data ,m ,1);
  853.                 val(tempcode ,map[m-1 ,n] ,symbol);
  854.             end;
  855.         end;
  856.         readln(mfile ,data);
  857.             {man}
  858.             coordinate:=copy(data ,1 ,2);
  859.             val(coordinate ,manx ,symbol);
  860.             coordinate:=copy(data ,4 ,2);
  861.             val(coordinate ,many ,symbol);
  862.         readln(mfile ,data);
  863.             {enemy A}
  864.             coordinate:=copy(data ,1 ,2);
  865.             val(coordinate ,enax ,symbol);
  866.             coordinate:=copy(data ,4 ,2);
  867.             val(coordinate ,enay ,symbol);
  868.         readln(mfile ,data);
  869.             {enemy B}
  870.             coordinate:=copy(data ,1 ,2);
  871.             val(coordinate ,enbx ,symbol);
  872.             coordinate:=copy(data ,4 ,2);
  873.             val(coordinate ,enby ,symbol);
  874.         readln(mfile ,data);
  875.             {enemy C}
  876.             coordinate:=copy(data ,1 ,2);
  877.             val(coordinate ,encx ,symbol);
  878.             coordinate:=copy(data ,4 ,2);
  879.             val(coordinate ,ency ,symbol);
  880.         readln(mfile ,data);
  881.             {door}
  882.             coordinate:=copy(data ,1 ,2);
  883.             val(coordinate ,doorx ,symbol);
  884.             coordinate:=copy(data ,4 ,2);
  885.             val(coordinate ,doory ,symbol);
  886.         close(mfile);
  887.     end;
  888.  
  889.         {draw map}
  890. procedure drawmap;
  891.     var    m ,n    :integer;
  892.         temp    :integer;
  893.     begin
  894.         _clearscreen(_gclearscreen);
  895.         goldrem:=0;
  896.         for n:=2 to 22 do begin
  897.             for m:=0 to 19 do begin
  898.                 temp:=map[m ,n];
  899.                 case temp of
  900.                 1    :    brick(m ,n);
  901.                 2    :    ladder(m ,n);
  902.                 3    :    wire(m ,n);
  903.                 4    :    begin
  904.                         gold(m ,n);
  905.                         goldrem:=goldrem+1;
  906.                         end;
  907.                 end;
  908.             end;
  909.         end;
  910.         man(manx ,many ,1);
  911.         enemy(enax ,enay ,1);
  912.         enemy(enbx ,enby ,1);
  913.         enemy(encx ,ency ,1);
  914.     end;
  915.  
  916. procedure clear(x ,y    :integer);    {clear part of unit}
  917.     begin
  918.         x:=x*32;
  919.         y:=y*20;
  920.         _setcolor(0);
  921.         _rectangle(_gfillinterior ,x+1 ,y+1 ,x+31 ,y+19);
  922.     end;
  923.  
  924. procedure breakclear(x ,y    :integer);    {clear of break brick procedure}
  925.     begin
  926.         x:=x*32;
  927.         y:=y*20;
  928.         _setcolor(0);
  929.         _rectangle(_gfillinterior ,x   ,y   ,x+32 ,y+20);
  930.     end;
  931.  
  932. procedure redraw(x ,y    :integer);    {redraw the background}
  933.     var    temp    :integer;
  934.     begin
  935.         temp:=map[x ,y];
  936.         case temp of
  937.         1    :    brick(x ,y);
  938.         2    :    ladder(x ,y);
  939.         3    :    wire(x ,y);
  940.         4    :    gold(x ,y);
  941.         end;
  942.         if temp<=-1 then brickenemy(x ,y);
  943.     end;
  944.  
  945. procedure refresh;
  946.     var    m ,n    :integer;
  947.         temp    :integer;
  948.     begin
  949.         for n:=2 to 22 do begin
  950.             for m:=0 to 19 do begin
  951.                 temp:=map[m ,n];
  952.                 if (temp>=5) and (temp<=8)
  953.                     then map[m ,n]:=temp+1
  954.                 else if (temp<=-1) and (temp>=-6)
  955.                     then map[m ,n]:=temp-1;
  956.                 if (temp>8) or (temp<-6) then begin
  957.                     clear(m ,n);
  958.                     map[m ,n]:=1;
  959.                     redraw(m ,n);
  960.                     end;
  961.                 end;
  962.             end;
  963.         end;
  964.  
  965.  
  966. procedure textprint;
  967.     var    p    :integer;
  968.         temp    :string;
  969.     begin
  970.  
  971.         _settextcolor(15);
  972.         for p:=0 to 79 do begin
  973.             _settextposition(0 ,p);
  974.             _outtext(' ');
  975.             end;
  976.         _settextposition(0 ,5);
  977.         str(level ,temp);
  978.         _outtext('Level :');_outtext(temp);
  979.         _settextposition(0 ,17);
  980.         str(live ,temp);
  981.         _outtext('Life remain :');_outtext(temp);
  982.         _settextposition(0 ,36);
  983.         str(score ,temp);
  984.         _outtext('Score :');_outtext(temp);
  985.         _settextposition(0 ,51);
  986.         str(goldrem ,temp);
  987.         _outtext('Gold remain :');_outtext(temp);
  988.     end;
  989.  
  990. procedure showcode;
  991.     var    temp    :string;
  992.         check    :boolean;
  993.         key    :char;
  994.     begin
  995.         _clearscreen(_gclearscreen);
  996.         _settextcolor(13);
  997.         _settextposition(7 ,34);
  998.         _outtext('Game Over');
  999.         _settextcolor(12);
  1000.         _settextposition(9 ,24);
  1001.         str(level ,temp);
  1002.         _outtext('You had been played at level ');
  1003.         _outtext(temp);
  1004.  
  1005.         _settextposition(11 ,23);
  1006.         _outtext('This password the this level is :');
  1007.  
  1008.         _settextposition(16 ,17);
  1009.         _outtext('You can type the password to play that level');
  1010.         _settextcolor(11);
  1011.         _settextposition(18 ,23);
  1012.         _outtext('Press Enter to back to main menu');
  1013.  
  1014.         _settextcolor(10);
  1015.         _settextposition(13 ,39-(length(code[level]) div 2));
  1016.         _outtext(code[level]);
  1017.  
  1018.         repeat
  1019.             check:=false;
  1020.             if keypressed then begin
  1021.                 key:=readkey;
  1022.                 if ord(key)=13 then check:=true;
  1023.             end;
  1024.         until check;
  1025.     end;
  1026.  
  1027.     {ending mapping}
  1028. {End of Start game procedure}
  1029.  
  1030. {movement}
  1031.     {fall down}
  1032. procedure fall(check    :string);
  1033.     begin
  1034.         if check='m' then begin    {man fall down}
  1035.             beep(4);
  1036.             clear(manx ,many);
  1037.             redraw(manx ,many);
  1038.             manact:=1;
  1039.             if (map[manx ,many+1]=1) or (map[manx ,many+1]=2)
  1040.                 then begin
  1041.                 if map[manx ,many]=4 then begin
  1042.                     beep(6);
  1043.                     map[manx ,many]:=0;
  1044.                     goldrem:=goldrem-1;
  1045.                     score:=score+5000;
  1046.                     textprint;
  1047.                     clear(manx ,many);
  1048.                     end;
  1049.                 manfall:=false;
  1050.                 man(manx ,many ,1);
  1051.                 manact:=0;
  1052.                 end
  1053.             else if (map[manx ,many+1])<=-1 then begin
  1054.                 clear(manx ,many);
  1055.                 redraw(manx ,many);
  1056.                 manfall:=false;
  1057.                 man(manx ,many ,1);
  1058.                 manact:=0;
  1059.                 end
  1060.             else many:=many+1;
  1061.             if map[manx ,many]=4    then begin
  1062.                 beep(6);
  1063.                 map[manx ,many]:=0;
  1064.                 goldrem:=goldrem-1;
  1065.                 score:=score+5000;
  1066.                 textprint;
  1067.                 clear(manx ,many);
  1068.                 beep(6);
  1069.                 if map[manx ,many+1]=0 then begin
  1070.                     manfall:=true;
  1071.                     fallman(manx ,many);
  1072.                     end
  1073.                     else begin
  1074.                     manfall:=false;
  1075.                     man(manx ,many ,manact);
  1076.                     if manact<>1 then manact:=1
  1077.                         else manact:=0;
  1078.                     end;
  1079.                 end
  1080.             else begin
  1081.                 case map[manx ,many] of
  1082.                 0    :    begin
  1083.                     if (map[manx ,many+1]<>1)
  1084.                        and (map[manx ,many+1]<>2)
  1085.                        and (map[manx ,many+1]>-1)
  1086.                         then fallman(manx ,many);
  1087.                     end;
  1088.                 3    :    begin
  1089.                     manfall:=false;
  1090.                     wireman(manx ,many ,manact);
  1091.                     if manact<>1 then manact:=1
  1092.                         else manact:=0;
  1093.                     end;
  1094.                 end;    {case}
  1095.             end;
  1096.         end    {ending m}
  1097.         else if check='a' then begin    {enemy A fall down}
  1098.             beep(8);
  1099.             clear(enax ,enay);
  1100.             redraw(enax ,enay);
  1101.             enaact:=1;
  1102.             if map[enax ,enay]=3 then enafall:=false
  1103.             else if (map[enax ,enay+1]=1) or (map[enax ,enay+1]=2)
  1104.                or (map[enax ,enay+1]<0)
  1105.                 then begin
  1106.                     if (map[enax ,enay]=4) and not(enagold)
  1107.                         then begin
  1108.                         map[enax ,enay]:=0;
  1109.                         clear(enax ,enay);
  1110.                         enagold:=true;
  1111.                     end;
  1112.                     enafall:=false;
  1113.                     enemy(enax ,enay ,enaact);
  1114.                     if enaact<>1 then enaact:=1
  1115.                         else enaact:=0;
  1116.                     end
  1117.                 else enay:=enay+1;
  1118.             if (map[enax ,enay]=4) and not(enagold)
  1119.                 then begin
  1120.                 map[enax ,enay]:=0;
  1121.                 clear(enax ,enay);
  1122.                 enagold:=true;
  1123.                 if map[enax ,enay+1]=0 then begin
  1124.                     enafall:=true;
  1125.                     fallenemy(enax ,enay);
  1126.                     end
  1127.                     else begin
  1128.                     enemy(enax ,enay ,enaact);
  1129.                     if enaact<>1 then enaact:=1
  1130.                         else enaact:=0;
  1131.                     end;
  1132.                 end
  1133.             else if map[enax ,enay+1]>=5 then begin
  1134.                 clear(enax ,enay);
  1135.                 if enagold then
  1136.                     map[enax ,enay]:=4;
  1137.                 redraw(enax ,enay);
  1138.                 enagold:=false;
  1139.                 enafall:=false;
  1140.                 enay:=enay+1;
  1141.                 score:=score+2000;
  1142.                 textprint;
  1143.                 brickenemy(enax ,enay);
  1144.                 map[enax ,enay]:=-1;
  1145.                 end
  1146.             else begin
  1147.                 case map[enax ,enay] of
  1148.                 0    :    begin
  1149.                     if (map[enax ,enay+1]<>1)
  1150.                         and (map[enax ,enay+1]<>2)
  1151.                         then fallenemy(enax ,enay);
  1152.                     end;
  1153.                 3    :    begin
  1154.                     enafall:=false;
  1155.                     wireenemy(enax ,enay ,enaact);
  1156.                     if enaact<>1 then enaact:=1
  1157.                         else enaact:=0;
  1158.                     end;
  1159.                 end;    {case}
  1160.             end;
  1161.         end;    {ending a}
  1162.         if check='b' then begin    {enemy B fall down}
  1163.             beep(8);
  1164.             clear(enbx ,enby);
  1165.             redraw(enbx ,enby);
  1166.             enbact:=1;
  1167.             if map[enbx ,enby]=3 then enbfall:=false
  1168.             else if (map[enbx ,enby+1]=1) or (map[enbx ,enby+1]=2)
  1169.                or (map[enbx ,enby+1]<0)
  1170.                 then begin
  1171.                     if (map[enbx ,enby]=4) and not(enbgold)
  1172.                         then begin
  1173.                         map[enbx ,enby]:=0;
  1174.                         clear(enbx ,enby);
  1175.                         enbgold:=true;
  1176.                     end;
  1177.                     enbfall:=false;
  1178.                     enemy(enbx ,enby ,enbact);
  1179.                     if enbact<>1 then enbact:=1
  1180.                         else enbact:=0;
  1181.                     end
  1182.                 else enby:=enby+1;
  1183.             if (map[enbx ,enby]=4) and not(enbgold)
  1184.                 then begin
  1185.                 map[enbx ,enby]:=0;
  1186.                 clear(enbx ,enby);
  1187.                 enbgold:=true;
  1188.                 if map[enbx ,enby+1]=0 then begin
  1189.                     enbfall:=true;
  1190.                     fallenemy(enbx ,enby);
  1191.                     end
  1192.                     else begin
  1193.                     enemy(enbx ,enby ,enbact);
  1194.                     if enbact<>1 then enbact:=1
  1195.                         else enbact:=0;
  1196.                     end;
  1197.                 end
  1198.             else if map[enbx ,enby+1]>=5 then begin
  1199.                 clear(enbx ,enby);
  1200.                 if enbgold then
  1201.                     map[enbx ,enby]:=4;
  1202.                 redraw(enbx ,enby);
  1203.                 enbgold:=false;
  1204.                 enbfall:=false;
  1205.                 enby:=enby+1;
  1206.                 score:=score+2000;
  1207.                 textprint;
  1208.                 brickenemy(enbx ,enby);
  1209.                 map[enbx ,enby]:=-1;
  1210.                 end
  1211.             else begin
  1212.                 case map[enbx ,enby] of
  1213.                 0    :    begin
  1214.                     if (map[enbx ,enby+1]<>1)
  1215.                         and (map[enbx ,enby+1]<>2)
  1216.                         then fallenemy(enbx ,enby);
  1217.                     end;
  1218.                 3    :    begin
  1219.                     enbfall:=false;
  1220.                     wireenemy(enbx ,enby ,enbact);
  1221.                     if enbact<>1 then enbact:=1
  1222.                         else enbact:=0;
  1223.                     end;
  1224.                 end;    {case}
  1225.             end;
  1226.         end;    {ending b}
  1227.         if check='c' then begin    {enemy C fall down}
  1228.             beep(8);
  1229.             clear(encx ,ency);
  1230.             redraw(encx ,ency);
  1231.             encact:=1;
  1232.             if map[encx ,ency]=3 then encfall:=false
  1233.             else if (map[encx ,ency+1]=1) or (map[encx ,ency+1]=2)
  1234.                or (map[encx ,ency+1]<0)
  1235.                 then begin
  1236.                     if (map[encx ,ency]=4) and not(encgold)
  1237.                         then begin
  1238.                         map[encx ,ency]:=0;
  1239.                         clear(encx ,ency);
  1240.                         encgold:=true;
  1241.                     end;
  1242.                     encfall:=false;
  1243.                     enemy(encx ,ency ,encact);
  1244.                     if encact<>1 then encact:=1
  1245.                         else encact:=0;
  1246.                     end
  1247.                 else ency:=ency+1;
  1248.             if (map[encx ,ency]=4) and not(encgold)
  1249.                 then begin
  1250.                 map[encx ,ency]:=0;
  1251.                 clear(encx ,ency);
  1252.                 encgold:=true;
  1253.                 if map[encx ,ency+1]=0 then begin
  1254.                     encfall:=true;
  1255.                     fallenemy(encx ,ency);
  1256.                     end
  1257.                     else begin
  1258.                     enemy(encx ,ency ,encact);
  1259.                     if encact<>1 then encact:=1
  1260.                         else encact:=0;
  1261.                     end;
  1262.                 end
  1263.             else if map[encx ,ency+1]>=5 then begin
  1264.                 clear(encx ,ency);
  1265.                 if encgold then
  1266.                     map[encx ,ency]:=4;
  1267.                 redraw(encx ,ency);
  1268.                 encgold:=false;
  1269.                 encfall:=false;
  1270.                 ency:=ency+1;
  1271.                 score:=score+2000;
  1272.                 textprint;
  1273.                 brickenemy(encx ,ency);
  1274.                 map[encx ,ency]:=-1;
  1275.                 end
  1276.             else begin
  1277.                 case map[encx ,ency] of
  1278.                 0    :    begin
  1279.                     if (map[encx ,ency+1]<>1)
  1280.                         and (map[encx ,ency+1]<>2)
  1281.                         then fallenemy(encx ,ency);
  1282.                     end;
  1283.                 3    :    begin
  1284.                     encfall:=false;
  1285.                     wireenemy(encx ,ency ,encact);
  1286.                     if encact<>1 then encact:=1
  1287.                         else encact:=0;
  1288.                     end;
  1289.                 end;    {case}
  1290.             end;
  1291.         end;    {ending c}
  1292.     end;
  1293.  
  1294.     {man}
  1295. procedure manmove;
  1296.     var    key    :char;
  1297.         temp    :boolean;
  1298.     begin
  1299.         if keypressed then begin
  1300.             key:=readkey;
  1301.             temp:=false;
  1302.             case ord(key) of
  1303.             44    :    begin    {break left brick}
  1304.             if map[manx-1 ,many]<>1 then begin
  1305.                 if map[manx-1 ,many+1]=1 then begin
  1306.                     if (map[manx-1 ,many]<>2) and
  1307.                        (map[manx-1 ,many]<>4) then begin
  1308.                         beep(5);
  1309.                         clear(manx ,many);
  1310.                         redraw(manx ,many);
  1311.                         breakclear(manx-1 ,many+1);
  1312.                 if (map[manx ,many]=0) or (map[manx ,many]>=5)
  1313.                      then break(manx ,many ,1)
  1314.             else if map[manx ,many]=2 then break(manx ,many ,3)
  1315.             else if map[manx ,many]=3 then break(manx ,many ,5);
  1316.                         map[manx-1 ,many+1]:=5;
  1317.                         _setcolor(7);
  1318.                 if map[manx ,many+1]=1 then    {right of brick}
  1319.     _rectangle(_gborder ,manx*32 ,(many+1)*20 ,manx*32+32 ,(many+1)*20+20);
  1320.                 if map[manx-2 ,many+1]=1 then    {left of brick}
  1321.     _rectangle(_gborder ,(manx-2)*32 ,(many+1)*20 ,(manx-2)*32+32 ,(many+1)*20+20);
  1322.                 if map[manx-1 ,many+2]=1 then    {lower of brick}
  1323.     _rectangle(_gborder ,(manx-1)*32 ,(many+2)*20 ,(manx-1)*32+32 ,(many+2)*20+20);
  1324.                 if map[manx-1 ,many]=1 then     {upper of brick}
  1325.     _rectangle(_gborder ,(manx-1)*32 ,many*20 ,(manx-1)*32+32 ,many*20+20);
  1326.                         end;
  1327.                     end;
  1328.                     end;    {break left brick}
  1329.             end;
  1330.  
  1331.             46    :    begin    {break right brick}
  1332.             if map[manx+1 ,many]<>1 then begin
  1333.                 if map[manx+1 ,many+1]=1 then begin
  1334.                     if (map[manx+1 ,many]<>2) and
  1335.                        (map[manx+1 ,many]<>4) then begin
  1336.                         beep(5);
  1337.                         clear(manx ,many);
  1338.                         redraw(manx ,many);
  1339.                         breakclear(manx+1 ,many+1);
  1340.                 if (map[manx ,many]=0) or (map[manx ,many]>=5)
  1341.                     then break(manx ,many ,2)
  1342.             else if map[manx ,many]=2 then break(manx ,many ,4)
  1343.             else if map[manx ,many]=3 then break(manx ,many ,6);
  1344.                         map[manx+1 ,many+1]:=5;
  1345.                         _setcolor(7);
  1346.                 if map[manx ,many+1]=1 then    {right of brick}
  1347.     _rectangle(_gborder ,manx*32 ,(many+1)*20 ,manx*32+32 ,(many+1)*20+20);
  1348.                 if map[manx+2 ,many+1]=1 then    {left of brick}
  1349.     _rectangle(_gborder ,(manx+2)*32 ,(many+1)*20 ,(manx+2)*32+32 ,(many+1)*20+20);
  1350.                 if map[manx+1 ,many+2]=1 then    {lower of brick}
  1351.     _rectangle(_gborder ,(manx+1)*32 ,(many+2)*20 ,(manx+1)*32+32 ,(many+2)*20+20);
  1352.                 if map[manx+1 ,many]=1 then     {upper of brick}
  1353.     _rectangle(_gborder ,(manx-1)*32 ,many*20 ,(manx-1)*32+32 ,many*20+20);
  1354.                         end;
  1355.                     end;
  1356.                     end;    {break right brick}
  1357.             end;
  1358.  
  1359.             72    :    begin    {up}
  1360.                 if many<>2 then begin
  1361.                 if (map[manx,many]=2) and
  1362.                 ((map[manx ,many-1]=0) or (map[manx ,many-1]=4)) then
  1363.                     temp:=true;
  1364.                 if (map[manx ,many-1]=2) or temp then begin
  1365.                     beep(2);
  1366.                     clear(manx ,many);
  1367.                     many:=many-1;
  1368.                     if map[manx ,many]=4 then begin
  1369.                             map[manx ,many]:=0;
  1370.                             goldrem:=goldrem-1;
  1371.                             score:=score+5000;
  1372.                             textprint;
  1373.                             clear(manx ,many);
  1374.                             manact:=1;
  1375.                             beep(6);
  1376.                             end;
  1377.                     if temp=true then begin
  1378.                         manact:=1;
  1379.                         man(manx ,many ,manact);
  1380.                         end
  1381.                         else climan(manx ,many ,manact);
  1382.                     if manact<>1 then manact:=1
  1383.                         else manact:=0;
  1384.                     redraw(manx ,many+1);
  1385.                     end;
  1386.                 end;    {if <>2}
  1387.                 end; {up}
  1388.  
  1389.             80    :    begin    {down}
  1390.                 if (map[manx ,many+1]=2) or
  1391.                    (map[manx ,many+1]=4) then begin
  1392.                     beep(2);
  1393.                     clear(manx ,many);
  1394.                     redraw(manx ,many);
  1395.                     many:=many+1;
  1396.                     case map[manx ,many] of
  1397.                     2    :    begin
  1398.                             climan(manx ,many ,manact);
  1399.                             if manact<>1 then manact:=1
  1400.                                 else manact:=0;
  1401.                             redraw(manx ,many-1);
  1402.                             end;
  1403.                     4    :    begin
  1404.                             map[manx ,many]:=0;
  1405.                             goldrem:=goldrem-1;
  1406.                             score:=score+5000;
  1407.                             textprint;
  1408.                             clear(manx ,many);
  1409.                             if map[manx ,many+1]=0 then begin
  1410.                                 manfall:=true;
  1411.                                 fallman(manx ,many);
  1412.                                 end
  1413.                                 else begin
  1414.                                 manact:=1;
  1415.                                 man(manx ,many ,manact);
  1416.                                 if manact<>1 then manact:=1
  1417.                                     else manact:=0;
  1418.                                 end;
  1419.                             end;
  1420.                         end;    {case}
  1421.                     end    {if}
  1422.                 else if map[manx ,many+1]=0 then begin
  1423.                     beep(4);
  1424.                     clear(manx ,many);
  1425.                     many:=many+1;
  1426.                     if map[manx ,many+1]=0 then begin
  1427.                         manfall:=true;
  1428.                         fallman(manx ,many);
  1429.                         end
  1430.                         else begin
  1431.                         man(manx ,many ,manact);
  1432.                         if manact<>1 then manact:=1
  1433.                             else manact:=0;
  1434.                         end;    {if}
  1435.                     redraw(manx ,many-1);
  1436.                     end    {if}
  1437.                 else if map[manx ,many+1]=3 then begin
  1438.                     beep(3);
  1439.                     clear(manx ,many);
  1440.                     many:=many+1;
  1441.                     manfall:=false;
  1442.                     wireman(manx ,many ,manact);
  1443.                     if manact<>1 then manact:=1
  1444.                         else manact:=0;
  1445.                     redraw(manx ,many-1);
  1446.                     end;    {if}
  1447.                 end;    {down}
  1448.  
  1449.             75    :    begin    {left}
  1450.                 if manx<>0 then begin
  1451.                 if map[manx-1 ,many]<>1 then begin
  1452.                     clear(manx ,many);
  1453.                     manx:=manx-1;
  1454.                     if manact=2 then manact:=0;
  1455.  
  1456.                     case map[manx ,many] of
  1457.                     2    :    begin
  1458.                             beep(1);
  1459.                             if map[manx ,many+1]<>2 then
  1460.                                 wcliman(manx ,many ,manact)
  1461.                                 else climan(manx ,many ,manact);
  1462.                             if manact<>1 then manact:=1
  1463.                                 else manact:=0;
  1464.                             redraw(manx+1 ,many);
  1465.                             end;
  1466.                     3    :    begin
  1467.                             beep(3);
  1468.                             wireman(manx ,many ,manact);
  1469.                             if manact<>1 then manact:=1
  1470.                                 else manact:=0;
  1471.                             redraw(manx+1 ,many);
  1472.                             end;
  1473.                     4    :    begin
  1474.                             map[manx ,many]:=0;
  1475.                             goldrem:=goldrem-1;
  1476.                             score:=score+5000;
  1477.                             textprint;
  1478.                             clear(manx ,many);
  1479.                             beep(6);
  1480.                             if map[manx ,many+1]=0 then begin
  1481.                                 beep(4);
  1482.                                 manfall:=true;
  1483.                                 fallman(manx ,many);
  1484.                                 end
  1485.                                 else begin
  1486.                                 man(manx ,many ,manact);
  1487.                                 if manact<>1 then manact:=1
  1488.                                     else manact:=0;
  1489.                                 end;
  1490.                             redraw(manx+1 ,many);
  1491.                             end;
  1492.                     0    :    begin
  1493.                             if (map[manx ,many+1]=0) or
  1494.                                (map[manx ,many+1]>=3) then begin
  1495.                                 beep(4);
  1496.                                 manfall:=true;
  1497.                                 fallman(manx ,many);
  1498.                                 end
  1499.                                 else begin
  1500.                                 beep(1);
  1501.                                 man(manx ,many ,manact);
  1502.                                 if manact<>1 then manact:=1
  1503.                                     else manact:=0;
  1504.                                 end;
  1505.                             redraw(manx+1 ,many);
  1506.                             end;
  1507.                         end;    {case}
  1508.                     if map[manx ,many]>=5 then begin
  1509.                         redraw(manx+1 ,many);
  1510.                         if (map[manx ,many+1]<>1) and (map[manx ,many]<>2)
  1511.                             then begin
  1512.                             beep(4);
  1513.                             manfall:=true;
  1514.                             fallman(manx ,many);
  1515.                             end
  1516.                         else man(manx ,many ,0);
  1517.                         end;    {if}
  1518.                     end;    {if}
  1519.                     end;    {if <>0}
  1520.                 end;    {left}
  1521.  
  1522.             77    :    begin    {right}
  1523.                 if manx<>19 then begin
  1524.                 if map[manx+1 ,many]<>1 then begin
  1525.                     clear(manx ,many);
  1526.                     redraw(manx ,many);
  1527.                     manx:=manx+1;
  1528.                     if manact=0 then manact:=2;
  1529.  
  1530.                     case map[manx ,many] of
  1531.                     2    :    begin
  1532.                             beep(1);
  1533.                             if map[manx ,many+1]<>2 then
  1534.                                 wcliman(manx ,many ,manact)
  1535.                                 else climan(manx ,many ,manact);
  1536.                             if manact<>1 then manact:=1
  1537.                                 else manact:=2;
  1538.                             end;
  1539.                     3    :    begin
  1540.                             beep(3);
  1541.                             wireman(manx ,many ,manact);
  1542.                             redraw(manx-1 ,many);
  1543.                             if manact<>1 then manact:=1
  1544.                                 else manact:=2;
  1545.                                 end;
  1546.                     4    :    begin
  1547.                             map[manx ,many]:=0;
  1548.                             goldrem:=goldrem-1;
  1549.                             score:=score+5000;
  1550.                             textprint;
  1551.                             clear(manx ,many);
  1552.                             beep(6);
  1553.                             if map[manx ,many+1]=0 then begin
  1554.                                 manfall:=true;
  1555.                                 fallman(manx ,many);
  1556.                                 end
  1557.                                 else begin
  1558.                                 beep(1);
  1559.                                 man(manx ,many ,manact);
  1560.                                 if manact<>1 then manact:=1
  1561.                                     else manact:=2;
  1562.                                 end;
  1563.                             redraw(manx-1 ,many);
  1564.                             end;
  1565.                     0    :    begin
  1566.                             if (map[manx ,many+1]=0) or
  1567.                                (map[manx ,many+1]>=3)then begin
  1568.                                 beep(4);
  1569.                                 manfall:=true;
  1570.                                 fallman(manx ,many);
  1571.                                 end
  1572.                                 else begin
  1573.                                 beep(1);
  1574.                                 man(manx ,many ,manact);
  1575.                                 if manact<>1 then manact:=1
  1576.                                     else manact:=2;
  1577.                                 end;
  1578.                             redraw(manx-1 ,many);
  1579.                             end;
  1580.                         end;    {case}
  1581.                     if map[manx ,many]>=5 then begin
  1582.                         redraw(manx-1 ,many);
  1583.                         if (map[manx ,many+1]<>1) and (map[manx ,many]<>2)
  1584.                             then begin
  1585.                             beep(4);
  1586.                             manfall:=true;
  1587.                             fallman(manx ,many);
  1588.                             end
  1589.                             else man(manx ,many ,2);
  1590.                         end;    {if}
  1591.                     end;    {right}
  1592.                 end;    {case}
  1593.             end;    {if}
  1594.         end;    {if}
  1595.         end;    {if <>22}
  1596.     end;
  1597.  
  1598. {enemy movemeny :hormove ,enemymove}
  1599. procedure hormove(var enex ,eney ,eneact    :integer;
  1600.             var enefall ,enegold    :boolean);
  1601.     var    diffx    :integer;    {different of x between enemy and man}
  1602.     begin
  1603.         diffx:=manx-enex;
  1604.         if diffx<0 then begin    {move left}
  1605.             if eneact=2 then eneact:=0;
  1606.             if map[enex-1 ,eney]<>1 then begin
  1607.                 clear(enex ,eney);
  1608.                 redraw(enex ,eney);
  1609.                 enex:=enex-1;
  1610.                 if (map[enex ,eney+1]=0) and (map[enex ,eney]<>2)
  1611.                     and (map[enex ,eney]<>3) then begin
  1612.                     enefall:=true;
  1613.                     fallenemy(enex ,eney);
  1614.                     end
  1615.                 else if map[enex ,eney]=2 then begin
  1616.                     if map[enex ,eney+1]=1
  1617.                         then wclienemy(enex ,eney ,eneact)
  1618.                     else clienemy(enex ,eney ,eneact);
  1619.                     if eneact<>1 then eneact:=1
  1620.                         else eneact:=0;
  1621.                     end
  1622.                 else if map[enex ,eney]=3 then begin
  1623.                     wireenemy(enex ,eney ,eneact);
  1624.                     if eneact<>1 then eneact:=1
  1625.                         else eneact:=0;
  1626.                     end
  1627.                 else if map[enex ,eney]=4 then begin
  1628.                     if not(enegold) then begin
  1629.                             enegold:=true;
  1630.                             clear(enex ,eney);
  1631.                             map[enex ,eney]:=0;
  1632.                             end;
  1633.                         enemy(enex ,eney ,eneact);
  1634.                         if eneact<>1 then eneact:=1
  1635.                             else eneact:=0;
  1636.                     end;
  1637.                 if (map[enex ,eney+1]>=5) and (map[enex ,eney]<>3)
  1638.                     then begin
  1639.                     clear(enex ,eney);
  1640.                     if enegold then
  1641.                         map[enex ,eney]:=4;
  1642.                     redraw(enex ,eney);
  1643.                     enegold:=false;
  1644.                     enefall:=false;
  1645.                     eney:=eney+1;
  1646.                     score:=score+2000;
  1647.                     textprint;
  1648.                     brickenemy(enex ,eney);
  1649.                     map[enex ,eney]:=map[enex ,eney]*(-1)+4;
  1650.                     end
  1651.                 else if (map[enex ,eney+1]=0) and (map[enex ,eney]<>3)
  1652.                     and (map[enex ,eney]<>2)
  1653.                     then begin
  1654.                     enefall:=true;
  1655.                     fallenemy(enex ,eney);
  1656.                     end
  1657.                 else if map[enex ,eney]<>3 then begin
  1658.                     enemy(enex ,eney ,eneact);
  1659.                     if eneact<>1 then eneact:=1
  1660.                         else eneact:=0;
  1661.                     end;
  1662.                 end;    {if OK}
  1663.             end    {if diffx<0}
  1664.         else if diffx>0 then begin    {move right}
  1665.             if eneact=0 then eneact:=2;
  1666.             if map[enex+1 ,eney]<>1 then begin
  1667.                 clear(enex ,eney);
  1668.                 redraw(enex ,eney);
  1669.                 enex:=enex+1;
  1670.                 if ( (map[enex ,eney+1]=0) or (map[enex ,eney+1]>=5) )
  1671.                     and (map[enex ,eney]<>2) and (map[enex ,eney]<>3)
  1672.                     then begin
  1673.                     enefall:=true;
  1674.                     fallenemy(enex ,eney);
  1675.                     end
  1676.                 else if map[enex ,eney]=2 then begin
  1677.                     if map[enex ,eney+1]=1
  1678.                         then wclienemy(enex ,eney ,eneact)
  1679.                     else clienemy(enex ,eney ,eneact);
  1680.                     if eneact<>1 then eneact:=1
  1681.                         else eneact:=2;
  1682.                     end
  1683.                 else if map[enex ,eney]=3 then begin
  1684.                     wireenemy(enex ,eney ,eneact);
  1685.                     if eneact<>1 then eneact:=1
  1686.                         else eneact:=2;
  1687.                     end
  1688.                 else if map[enex ,eney]=4 then begin
  1689.                     if not(enegold) then begin
  1690.                             enegold:=true;
  1691.                             clear(enex ,eney);
  1692.                             map[enex ,eney]:=0;
  1693.                             end;
  1694.                         enemy(enex ,eney ,eneact);
  1695.                         if eneact<>1 then eneact:=1
  1696.                             else eneact:=2;
  1697.                         end;
  1698.                 if (map[enex ,eney+1]>=5) and (map[enex ,eney]<>3)
  1699.                     then begin
  1700.                     clear(enex ,eney);
  1701.                     if enegold then
  1702.                         map[enex ,eney]:=4;
  1703.                     redraw(enex ,eney);
  1704.                     enegold:=false;
  1705.                     enefall:=false;
  1706.                     eney:=eney+1;
  1707.                     score:=score+2000;
  1708.                     textprint;
  1709.                     brickenemy(enex ,eney);
  1710.                     map[enex ,eney]:=map[enex ,eney]*(-1)+4;
  1711.                     end
  1712.                 else if (map[enex ,eney+1]=0) and (map[enex ,eney]<>3)
  1713.                     and (map[enex ,eney]<>2)
  1714.                     then begin
  1715.                     enefall:=true;
  1716.                     fallenemy(enex ,eney);
  1717.                     end
  1718.                 else if map[enex ,eney]<>3 then begin
  1719.                     enemy(enex ,eney ,eneact);
  1720.                     if eneact<>1 then eneact:=1
  1721.                         else eneact:=2;
  1722.                     end;
  1723.                 end;    {if OK}
  1724.             end    {if diffx>0}
  1725.         else if diffx=0 then begin
  1726.             clear(enex ,eney);
  1727.             redraw(enex ,eney);
  1728.             if map[enex ,eney]=3 then
  1729.                 wireenemy(enex ,eney ,eneact)
  1730.             else if map[enex ,eney]=2 then begin
  1731.                 if map[enex ,eney+1]=1 then
  1732.                     wclienemy(enex ,eney ,eneact)
  1733.                 else clienemy(enex ,eney ,eneact);
  1734.                 end
  1735.             else if map[enex ,eney]=0
  1736.                 then enemy(enex ,eney ,eneact);
  1737.             end;
  1738.         end;    {end of procedure}
  1739.  
  1740. procedure enemymove(var enex ,eney ,eneact    :integer;    {enemy movement}
  1741.              var enefall ,enegold        :boolean);
  1742.     var    diffy    :integer;    {different of y between enemy and man}
  1743.         diffx    :integer;    {different of x between enemy and man}
  1744.     begin
  1745.         diffy:=many-eney;
  1746.         diffx:=manx-enex;
  1747.         if map[enex ,eney]<-5 then begin
  1748.             map[enex ,eney]:=1;
  1749.             clear(enex ,eney);
  1750.             redraw(enex ,eney);
  1751.             enex:=doorx;
  1752.             eney:=doory;
  1753.             beep(9);
  1754.             end
  1755.         else if (map[enex ,eney]<=4) and (map[enex ,eney]>=0)
  1756.             then begin
  1757.             enefall:=false;
  1758.             if diffy<0 then begin    {up}
  1759.                 if (map[enex ,eney]=2) and (map[enex ,eney-1]<>1)
  1760.                     then begin
  1761.                     clear(enex ,eney);
  1762.                     redraw(enex ,eney);
  1763.                     eney:=eney-1;
  1764.                     if map[enex ,eney]=2
  1765.                         then begin
  1766.                             clienemy(enex ,eney ,eneact);
  1767.                             if eneact=1 then eneact:=0
  1768.                                 else eneact:=1;
  1769.                         end
  1770.                     else if map[enex ,eney]=0
  1771.                         then begin
  1772.                         enemy(enex ,eney ,1);
  1773.                         eneact:=0;
  1774.                         end
  1775.                     else if map[enex ,eney]=4
  1776.                         then begin
  1777.                         if not(enegold) then begin
  1778.                             enegold:=true;
  1779.                             clear(enex ,eney);
  1780.                             map[enex ,eney]:=0;
  1781.                             end;
  1782.                         enemy(enex ,eney ,1);
  1783.                         eneact:=0;
  1784.                         end;
  1785.                     end    {end if enemy can climb up}
  1786.                 else hormove(enex ,eney ,eneact ,enefall ,enegold);
  1787.                 end    {if diffy<0}
  1788.             else if diffy>0 then begin    {down}
  1789.                 if ( (map[enex ,eney]=2) and (map[enex ,eney+1]<>1) )
  1790.                     or (map[enex ,eney+1]=2)
  1791.                     then begin
  1792.                     clear(enex ,eney);
  1793.                     redraw(enex ,eney);
  1794.                     eney:=eney+1;
  1795.                     if map[enex ,eney]=2
  1796.                         then begin
  1797.                         enefall:=false;
  1798.                         if map[enex ,eney+1]=1
  1799.                             then wclienemy(enex ,eney ,1)
  1800.                         else clienemy(enex ,eney ,eneact);
  1801.                         if eneact<>1 then eneact:=1
  1802.                             else eneact:=0;
  1803.                         end
  1804.                     else if map[enex ,eney]=0
  1805.                         then begin
  1806.                         if (map[enex ,eney+1]=0)
  1807.                            or (map[enex ,eney+1]=3)
  1808.                             then begin
  1809.                             enefall:=true;
  1810.                             fallenemy(enex ,eney);
  1811.                             end
  1812.                         else begin
  1813.                             enemy(enex ,eney ,1);
  1814.                             eneact:=0;
  1815.                             end
  1816.                          end
  1817.                     else if map[enex ,eney]=4
  1818.                         then begin
  1819.                         if not(enegold) then begin
  1820.                             enegold:=true;
  1821.                             clear(enex ,eney);
  1822.                             map[enex ,eney]:=0;
  1823.                             end;
  1824.                         if map[enex ,eney+1]<>0
  1825.                             then begin
  1826.                             man(enex ,eney ,1);
  1827.                             eneact:=0;
  1828.                             end
  1829.                         else begin
  1830.                             enefall:=true;
  1831.                             fallenemy(enex ,eney);
  1832.                             end;
  1833.                         end
  1834.                     else if map[enex ,eney+1]>=5 then begin
  1835.                         clear(enex ,eney);
  1836.                         if enegold then
  1837.                             map[enex ,eney]:=4;
  1838.                         redraw(enex ,eney);
  1839.                         enegold:=false;
  1840.                         eney:=eney+1;
  1841.                         score:=score+2000;
  1842.                         textprint;
  1843.                         brickenemy(enex ,eney);
  1844.                         map[enex ,eney]:=map[enex ,eney]*(-1)+4;
  1845.                         end;
  1846.                     end    {end if enemy can climb down}
  1847.                 else  if (diffx<=1) and (diffx>=-1)
  1848.                     and (map[enex ,eney+1]=0) then begin
  1849.                     clear(enex ,eney);
  1850.                     redraw(enex ,eney);
  1851.                     eney:=eney+1;
  1852.                     enefall:=true;
  1853.                     fallenemy(enex ,eney);
  1854.                     end
  1855.                 else hormove(enex ,eney ,eneact ,enefall ,enegold);
  1856.                 end
  1857.             else if diffy=0 then hormove(enex ,eney ,eneact ,enefall ,enegold);
  1858.         end;    {if can move to any direction}
  1859.     end;    {end of procedure}
  1860.  
  1861. procedure entergame;
  1862.     var    key    :char;
  1863.         n ,m    :integer;
  1864.         act    :integer;
  1865.         hit    :boolean;
  1866.     begin
  1867.         _clearscreen(_gclearscreen);
  1868.         act:=1;
  1869.         hit:=false;
  1870.         for n:=2 to 21 do begin
  1871.             for m:=1 to 18 do begin
  1872.                 man(m ,n ,act);
  1873.                 act:=act+1;
  1874.                 if act=3 then act:=0;
  1875.             end;
  1876.         end;
  1877.         _setcolor(12);
  1878.         _rectangle(_gfillinterior ,6*32 ,9*20 ,12*32-5 ,14*20);
  1879.         _setcolor(0);
  1880.         _rectangle(_gfillinterior ,6*32+5 ,9*20+5 ,12*35-45 ,14*20-5);
  1881.         _settextcolor(10);
  1882.         _settextposition(14 ,30);
  1883.         _outtext('Load Runner 98');
  1884.         _settextposition(16 ,30);
  1885.         _outtext('Press any key');
  1886.         repeat
  1887.             if keypressed then begin
  1888.                 key:=readkey;
  1889.                 hit:=true;
  1890.                 if ord(key)=13 then key:='a';
  1891.                 end;
  1892.         until hit;
  1893.     end;
  1894.  
  1895.  
  1896. procedure endgame;
  1897.     var    hit    :boolean;
  1898.         p ,q    :integer;
  1899.         key    :char;
  1900.     begin
  1901.         hit:=false;
  1902.         a:=_setvideomode(_defaultmode);
  1903.         clrscr;
  1904.         gotoxy(30 ,5);
  1905.         textcolor(11);
  1906.         writeln('Congratulation');
  1907.         gotoxy(20 ,6);
  1908.         writeln('You had played all the level of this game');
  1909.         gotoxy(23 ,7);
  1910.         writeln('Thank you for you to play this game');
  1911.         gotoxy(20 ,9);
  1912.         textcolor(12);
  1913.         writeln('Staff List :');
  1914.         gotoxy(20 ,10);
  1915.         textcolor(10);
  1916.         writeln('Producer          :Chan Man Fat');
  1917.         gotoxy(20 ,11);
  1918.         writeln('Director           :Chan Man Fat');
  1919.         gotoxy(20 ,12);
  1920.         writeln('Programmer         :Chan Man Fat');
  1921.         gotoxy(20 ,13);
  1922.         writeln('Graphics Editor    :Chan Man Fat');
  1923.         gotoxy(20 ,14);
  1924.         writeln('Sound Editor       :Chan Man Fat');
  1925.         gotoxy(30 ,16);
  1926.         textcolor(16);
  1927.         writeln('Load Runner version 98');
  1928.         repeat
  1929.             if keypressed then begin
  1930.                 hit:=true;
  1931.                 key:=readkey;
  1932.                 if ord(key)=13 then key:='a';
  1933.             end;
  1934.         until hit;
  1935.     end;
  1936.  
  1937. function press (live ,level :integer):boolean;
  1938.     var    temp    :string;
  1939.         hit    :boolean;
  1940.         key    :char;
  1941.     begin
  1942.         press:=false;
  1943.         hit:=false;
  1944.         _clearscreen(_gclearscreen);
  1945.         _settextcolor(11);
  1946.         _settextposition(9 ,30);
  1947.         str(live ,temp);
  1948.         _outtext('You have ');_outtext(temp);_outtext(' life remain');
  1949.         _settextposition(11 ,38);
  1950.         str(level ,temp);
  1951.         _outtext('Level ');_outtext(temp);
  1952.         _settextposition(13 ,29);
  1953.         _outtext('Press any key to play now');
  1954.         repeat
  1955.             if keypressed then begin
  1956.                 press:=true;
  1957.                 hit:=true;
  1958.                 key:=readkey;
  1959.                 if (ord(key)=44) or (ord(key)=46)
  1960.                 or (ord(key)=72) or (ord(key)=80)
  1961.                 or (ord(key)=75) or (ord(key)=77)
  1962.                     then key:='a';
  1963.             end;
  1964.         until hit;
  1965.     end;
  1966.  
  1967. {start game}
  1968. procedure start;
  1969.     var    temp        :longint;
  1970.         p ,q ,n    :integer;
  1971.         finish        :boolean;    {if finish the mission of the level then true}
  1972.         again        :boolean;    {play again the level if true}
  1973.         templive    :integer;
  1974.     begin
  1975.         live:=2;
  1976.         if comp=1 then n:=500
  1977.             else n:=50;
  1978.         repeat    {repeat ..until lost all life}
  1979.             manact:=1;
  1980.             enaact:=0;
  1981.             enbact:=0;
  1982.             encact:=0;
  1983.             manfall:=false;
  1984.             enafall:=false;enagold:=false;
  1985.             enbfall:=false;enbgold:=false;
  1986.             encfall:=false;encgold:=false;
  1987.             if press(live ,level) then begin
  1988.             temp:=4;
  1989.             readmap;
  1990.             drawmap;
  1991.             textprint;
  1992.             finish:=false;
  1993.             repeat    {repeat ..until die or go to next level}
  1994.                 again:=false;
  1995.                 templive:=live;
  1996.                 if temp mod 20=0 then refresh;
  1997.                 if many<>22 then begin
  1998.                     if manfall then fall('m')
  1999.                     else for p:=1 to n
  2000.                         do begin
  2001.                         manmove;
  2002.                         if    ((manx=enax) and (many=enay)) or
  2003.                             ((manx=enbx) and (many=enby)) or
  2004.                             ((manx=encx) and (many=ency))
  2005.                             then begin
  2006.                                 if die then begin
  2007.                                 again:=true;
  2008.                                 live:=live-1;
  2009.                                 end;
  2010.                             end;
  2011.                         end;
  2012.                     end
  2013.                     else begin
  2014.                         again:=true;
  2015.                         live:=live-1;
  2016.                     end;
  2017.                 if    (speed=1) and (temp mod 7=0) or
  2018.                     (speed=2) and (temp mod 5=0) or
  2019.                     (speed=3) and (temp mod 3=0) then begin
  2020.                     if enafall then fall('a')
  2021.                     else if (map[enax ,enay]<5) and
  2022.                          odd(temp) then
  2023.                         enemymove(enax ,enay ,enaact ,enafall ,enagold);
  2024.                     if enbfall then fall('b')
  2025.                     else if (map[enbx ,enby]<5) and
  2026.                         odd(temp) then
  2027.                         enemymove(enbx ,enby ,enbact ,enbfall ,enbgold);
  2028.                     if encfall then fall('c')
  2029.                     else if (map[encx ,ency]<5) and
  2030.                         odd(temp) then
  2031.                         enemymove(encx ,ency ,encact ,encfall ,encgold);
  2032.                     end;
  2033.                 temp:=temp+1;
  2034.                 if temp=1000000000 then temp:=4;
  2035.                     {time delay}
  2036.                 if wait=1 then begin
  2037.                     for p:=1 to 21 do
  2038.                         for q:=1 to 767+32000*(comp) do;
  2039.                     end
  2040.                        else if wait=2 then begin
  2041.                     for p:=1 to 9 do
  2042.                         for q:=1 to 767+32000*(comp) do;
  2043.                     end
  2044.                 else if wait=3 then begin
  2045.                     for p:=1 to 2 do
  2046.                         for q:=1 to 767+32000*(comp) do;
  2047.                     end;    {end of time delay}
  2048.                 if    ((manx=enax) and (many=enay)) or
  2049.                     ((manx=enbx) and (many=enby)) or
  2050.                     ((manx=encx) and (many=ency))
  2051.                         then begin
  2052.                         if die and not(again) then begin
  2053.                             again:=true;
  2054.                             live:=live-1;
  2055.                             end;
  2056.                         end;
  2057.                 if templive-live>1 then live:=templive-1;
  2058.             until again or (goldrem=0);
  2059.             beep(7);
  2060.             finish:=false;
  2061.             if goldrem=0 then level:=level+1;
  2062.             if live<0 then finish:=true;
  2063.             if level=5 then finish:=true;
  2064.             end;
  2065.         until finish;
  2066.         if live<0 then showcode
  2067.         else if level=5 then endgame;
  2068.         level:=1;
  2069.         live:=2;
  2070.         score:=0;
  2071.     end;
  2072.  
  2073. {menu procedure: introduce ,option}
  2074. procedure introduce;
  2075.     var    x ,y    :integer;
  2076.         check    :boolean;
  2077.         key    :char;
  2078.       begin
  2079.           _clearscreen(_gclearscreen);
  2080.           {text}
  2081.           _settextcolor(12);
  2082.           _settextposition(3 ,10);_outtext('Programmer  :  Chan Man Fat ');
  2083.           _settextposition(4 ,10);_outtext('Site  :  http://www.geocities.com/Colosseum/Sideline/1858/index.html');
  2084.           _settextposition(5 ,10);_outtext('Welcome to visit my site');
  2085.           _settextcolor(11);
  2086.           _settextposition(8 ,1);
  2087.           _outtext('    This game is Load Runner .In  this game ,you are a tomb  raider .You should');
  2088.           _settextposition(9 ,1);
  2089.           _outtext('steal the gold  in the tomb .Avoid to be caught by the guard ,you can break the');
  2090.           _settextposition(10 ,1);
  2091.           _outtext('brick ,and then they  will fall to  the hole .If they  have gold ,the gold will');
  2092.           _settextposition(11 ,1);
  2093.           _outtext('fall to the land if they fall to hole .');
  2094.           _settextcolor(7);
  2095.           _settextposition(12 ,1);
  2096.           _outtext('Here are the control method of the game :');
  2097.           _settextposition(16 ,7) ;_settextcolor(14);_outtext('< ');
  2098.             _settextcolor(15);_outtext('-- Break the left-down brick');
  2099.           _settextposition(17 ,7) ;_settextcolor(14);_outtext('> ');
  2100.             _settextcolor(15);_outtext('-- Break the right-down brick');
  2101.           _settextposition(19 ,8);_settextcolor(10);_outtext('No need to press Shift when press < and >');
  2102.           _settextposition(23 ,1) ;_settextcolor(9);_outtext('Press Enter to next page');
  2103.           _settextposition(16 ,50);_settextcolor(15);_outtext('Direction key');
  2104.  
  2105.           {Cursor}
  2106.           _setcolor(14);
  2107.             {up}
  2108.             _moveto(450 ,230);_lineto(450 ,200);
  2109.             _lineto(440 ,210);_moveto(450 ,200);_lineto(460 ,210);
  2110.             {down}
  2111.             _moveto(450 ,270);_lineto(450 ,300);
  2112.             _lineto(440 ,290);_moveto(450 ,300);_lineto(460 ,290);
  2113.             {left}
  2114.             _moveto(380 ,250);_lineto(350 ,250);
  2115.             _lineto(360 ,240);_moveto(350 ,250);_lineto(360 ,260);
  2116.             {right}
  2117.             _moveto(510 ,250);_lineto(540 ,250);
  2118.             _lineto(530 ,240);_moveto(540 ,250);_lineto(530 ,260);
  2119.  
  2120.           repeat
  2121.             check:=false;
  2122.             if keypressed then begin
  2123.                 key:=readkey;
  2124.                 if ord(key)=13 then check:=true;
  2125.             end;
  2126.           until check;
  2127.           _clearscreen(_gclearscreen);
  2128.           {Drawing}
  2129.           man(4 ,3 ,1);
  2130.           enemy(4 ,6 ,1);
  2131.           brick(4 ,9);
  2132.           wire(4 ,12);
  2133.           ladder(4 ,15);
  2134.           gold(4 ,18);
  2135.           {Outtext}
  2136.           _settextposition(2 ,30);
  2137.             _settextcolor(13);
  2138.             _outtext('Symbol representation');
  2139.           _settextcolor(15);
  2140.           _settextposition(5 ,25);
  2141.             _outtext('-- He is the man that you control him');
  2142.             _settextposition(6 ,25);
  2143.             _outtext('You should take him to get all the gold');
  2144.           _settextposition(8 ,25);
  2145.             _settextcolor(14);
  2146.             _outtext('-- He is the enemy that if you are caught by him ,then');
  2147.             _settextposition(9 ,25);
  2148.             _outtext('you will die .In this game ,each level has 3 enemies');
  2149.           _settextposition(12 ,25);
  2150.             _settextcolor(12);
  2151.             _outtext('-- It is the brick that you can break it');
  2152.             _settextposition(13 ,25);
  2153.             _outtext(',to bury the enemies the this hole');
  2154.           _settextposition(15 ,25);
  2155.             _settextcolor(11);
  2156.             _outtext('-- It is the wire that you can climb on it');
  2157.             _settextposition(16 ,25);
  2158.             _outtext(',to walk to another place');
  2159.           _settextposition(19 ,25);
  2160.             _settextcolor(10);
  2161.             _outtext('-- It is the ladder that you can climb on it');
  2162.             _settextposition(20 ,25);
  2163.             _outtext(',to climb up or down to another place');
  2164.           _settextposition(22 ,25);
  2165.             _settextcolor(14);
  2166.             _outtext('-- It is the gold that you should get it');
  2167.             _settextposition(23 ,25);
  2168.             _outtext('.After you get all the gold ,you should go');
  2169.             _settextposition(24 ,25);
  2170.             _outtext('to the highest place by climbing ladder');
  2171.           repeat
  2172.             check:=false;
  2173.             if keypressed then begin
  2174.                 key:=readkey;
  2175.                 if ord(key)=13 then check:=true;
  2176.             end;
  2177.           until check;
  2178.       end;
  2179. procedure option;
  2180.       var    choice    ,n ,m ,draw    :integer;
  2181.         enter            :boolean;
  2182.         key            :char;
  2183.         default ,d  ,p        :integer;
  2184.       begin
  2185.         n:=20;
  2186.         draw:=1;
  2187.         a:=_setvideomode(_maxresmode);
  2188.         repeat
  2189.             _setcolor(10);
  2190.             _rectangle(_gfillinterior ,60 ,n ,90 ,n+20);
  2191.             _setcolor(0);
  2192.             _rectangle(_gfillinterior ,62 ,n+2    ,88 ,n+18);
  2193.             draw:=draw+1;
  2194.             n:=n+40;
  2195.         until draw>11;
  2196.         m:=20;
  2197.         choice:=1;
  2198.         enter:=true;
  2199.         {text}
  2200.         _settextcolor(14);
  2201.         {1}_settextposition(2  ,13);_outtext('-- Enemies'' speed slow');
  2202.         {2}_settextposition(5  ,13);_outtext('-- Enemies'' speed normal');
  2203.         {3}_settextposition(7  ,13);_outtext('-- Enemies'' speed fast');
  2204.         _settextcolor(13);
  2205.         {4}_settextposition(10 ,13);_outtext('-- Game''s speed slow');
  2206.         {5}_settextposition(12 ,13);_outtext('-- Game''s speed normal');
  2207.         {6}_settextposition(15 ,13);_outtext('-- Game''s speed fast');
  2208.         _settextcolor(11);
  2209.         {7}_settextposition(17 ,13);_outtext('-- Sound on');
  2210.         {8}_settextposition(20 ,13);_outtext('-- Sound off');
  2211.         _settextcolor(12);
  2212.         {9}_settextposition(22 ,13);_outtext('-- Slower computer (386SX to 486DX33)');
  2213.        {10}_settextposition(25 ,13);_outtext('-- Faster computer (486DX-66 or upper)');
  2214.         _settextcolor(15);
  2215.        {11}_settextposition(27 ,13);_outtext('-- Exit to main meun');
  2216.  
  2217.         _settextcolor(14);
  2218.         _settextposition(29 ,10);_outtext('Yellow in color is represent the default setting');
  2219.  
  2220.  
  2221.         repeat
  2222.             default:=1;
  2223.             _setcolor(12);
  2224.             _rectangle(_gfillinterior ,62 ,m+2 ,88 ,m+18);
  2225.  
  2226.             {highlight default setting}
  2227.             repeat
  2228.                 d:=20;
  2229.                 _setcolor(14);
  2230.                 if (default<=3) and (default=speed) then begin
  2231.                     d:=d+40*(default-1);
  2232.                     _rectangle(_gfillinterior ,62 ,d+2 ,88 ,d+18)
  2233.                     end
  2234.                 else if (default<=6) and (default=wait+3) then begin
  2235.                     d:=d+40*(default-1);
  2236.                     _rectangle(_gfillinterior ,62 ,d+2 ,88 ,d+18)
  2237.                     end
  2238.                 else if (default<=8) and (default=music+7) then begin
  2239.                     d:=d+40*(default-1);
  2240.                     _rectangle(_gfillinterior ,62 ,d+2 ,88 ,d+18)
  2241.                     end
  2242.                 else if (default<=11) and (default=comp+9) then begin
  2243.                     d:=d+40*(default-1);
  2244.                     _rectangle(_gfillinterior ,62 ,d+2 ,88 ,d+18)
  2245.                     end;
  2246.                 default:=default+1;
  2247.  
  2248.             {hit key}
  2249.             if keypressed then begin
  2250.                 key:=readkey;
  2251.                 case ord(key) of
  2252.                 72    :    begin
  2253.                     _setcolor(0);
  2254.             _rectangle(_gfillinterior ,62 ,m+2 ,88 ,m+18);
  2255.                     if choice>1 then begin
  2256.                         m:=m-40;
  2257.                         choice:=choice-1;
  2258.                         end
  2259.                     else begin
  2260.                         m:=m+40*10;
  2261.                         choice:=11;
  2262.                         end;
  2263.                     _setcolor(12);
  2264.             _rectangle(_gfillinterior ,62 ,m+2 ,88 ,m+18);
  2265.                     end;
  2266.                     80    :    begin
  2267.                     _setcolor(0);
  2268.             _rectangle(_gfillinterior ,62 ,m+2 ,88 ,m+18);
  2269.                     if choice<11 then begin
  2270.                         m:=m+40;
  2271.                         choice:=choice+1;
  2272.                         end
  2273.                     else begin
  2274.                         m:=m-40*10;
  2275.                         choice:=1;
  2276.                         end;
  2277.                     _setcolor(12);
  2278.             _rectangle(_gfillinterior ,62 ,m+2 ,88 ,m+18);
  2279.                     end;
  2280.                 13    :    begin
  2281.                     for p:=1 to 11 do begin;
  2282.                         _setcolor(0);
  2283.             _rectangle(_gfillinterior ,62 ,20+2+(p-1)*40 ,88 ,20+18+(p-1)*40);
  2284.                     end;
  2285.                     if choice<=3 then speed:=choice
  2286.                     else if choice<=6 then wait:=choice-3
  2287.                     else if choice<=8 then music:=choice-7
  2288.                     else if choice<=10 then comp:=choice-9
  2289.                     else enter:=false;
  2290.                     end;
  2291.                 end;
  2292.             end;
  2293.             until default>11;
  2294.         until not(enter);
  2295.       end;
  2296.  
  2297. {game procedure: gamecode ,start}
  2298. procedure gamecode(var die    :boolean);
  2299.       var    readtext        :string;
  2300.         again ,checkcode    :boolean;
  2301.         p            :integer;
  2302.         key            :char;
  2303.         check            :boolean;
  2304.       begin
  2305.           repeat
  2306.             checkcode:=false;  {If input is successfull ,it will true}
  2307.             clrscr;
  2308.             again:=true;
  2309.             gotoxy(25 ,2);textcolor(15);
  2310.             writeln('Load Runner Code Center');
  2311.             gotoxy(3 ,4);textcolor(14);
  2312.             writeln('Press Enter to back to main menu');
  2313.             gotoxy(3 ,5);textcolor(7);
  2314.             write('Please input the code of the level --');
  2315.             textcolor(12);
  2316.             readln(readtext);
  2317.             if readtext='' then again:=false
  2318.             else begin
  2319.               for p:=1 to 5 do begin
  2320.                  if readtext=code[p] then begin
  2321.                  again:=false;
  2322.                  checkcode:=true;
  2323.                  if (p>=1) and (p<=4) then begin
  2324.                     level:=no[p];
  2325.                     if level=0 then level:=1;
  2326.                     p:=5;
  2327.                     textcolor(11);
  2328.                     writeln('You can go to play level ',level);
  2329.                     writeln('Please press Enter to exit to main menu');
  2330.                     writeln(',and select "Start new game" to play');
  2331.                     check:=true;
  2332.                     again:=false;
  2333.                     textcolor(12);
  2334.                     repeat
  2335.                     if keypressed then begin
  2336.                     key:=readkey;
  2337.                     if ord(key)=13 then check:=false;
  2338.                     end;
  2339.                     until not(check);
  2340.                  end
  2341.                  else begin
  2342.                      textcolor(11);
  2343.                      writeln('You will not die....');
  2344.                      die:=false;
  2345.                      again:=true;
  2346.                      check:=true;
  2347.                      textcolor(12);
  2348.                      repeat
  2349.                      if keypressed then begin
  2350.                      key:=readkey;
  2351.                      if ord(key)=13 then check:=false;
  2352.                         end;
  2353.                      until not(check);
  2354.                  end;
  2355.                  end;
  2356.               end;
  2357.             end;
  2358.             if not(checkcode) and (readtext<>'')
  2359.             and (readtext<>'')then begin
  2360.               textcolor(10);
  2361.               writeln('Wrong code .');
  2362.               write('Please press Enter to input again');
  2363.               check:=true;
  2364.               textcolor(12);
  2365.               repeat
  2366.                 if keypressed then begin
  2367.                     key:=readkey;
  2368.                     if ord(key)=13 then check:=false;
  2369.                 end;
  2370.               until not(check);
  2371.             end;
  2372.           until not(again);
  2373.       end;
  2374.  
  2375. procedure menu(var exit    :boolean);
  2376.       var    no ,symbol    :integer;
  2377.         choice         :integer;
  2378.         key             :char;
  2379.         again ,enter    :boolean;
  2380.         n ,m ,draw      :integer;
  2381.       begin
  2382.           repeat
  2383.             _getvideoconfig(vc);
  2384.             a:=_setvideomode(_maxresmode);
  2385.             n:=103;
  2386.             draw:=1;
  2387.             again:=true;
  2388.             _clearscreen(_gclearscreen);
  2389.             repeat
  2390.                 _setcolor(10);
  2391.                 _rectangle(_gfillinterior ,150 ,n ,180 ,n+20);
  2392.                 _setcolor(0);
  2393.                 _rectangle(_gfillinterior ,152 ,n+2 ,178 ,n+18);
  2394.                 n:=n+35;
  2395.                 draw:=draw+1;
  2396.             until draw>5;
  2397.             {text}
  2398.             _settextcolor(14);
  2399.             _settextposition(5 ,25);_outtext('Welcome to Load Runner');
  2400.             _settextcolor(15);
  2401.             _settextposition(8  ,25);_outtext('Introduction of the game');
  2402.             _settextposition(10 ,25);_outtext('Select the level of the game');
  2403.             _settextposition(12 ,25);_outtext('Option of the game');
  2404.             _settextposition(14 ,25);_outtext('Start new game');
  2405.             _settextposition(16 ,25);_outtext('Exit the game');
  2406.  
  2407.             m:=103;
  2408.             choice:=1;
  2409.             enter:=true;
  2410.             repeat
  2411.             _setcolor(12);
  2412.             _rectangle(_gfillinterior ,152 ,m+2 ,178 ,m+18);
  2413.                 if keypressed then begin
  2414.                 key:=readkey;
  2415.                     case ord(key) of
  2416.                     72    :    begin
  2417.                         _setcolor(0);
  2418.             _rectangle(_gfillinterior ,152 ,m+2 ,178 ,m+18);
  2419.                         if choice>1 then begin
  2420.                             m:=m-35;
  2421.                             choice:=choice-1;
  2422.                             end
  2423.                         else begin
  2424.                             m:=m+35*4;
  2425.                             choice:=5;
  2426.                             end;
  2427.                         _setcolor(12);
  2428.             _rectangle(_gfillinterior ,152 ,m+2 ,178 ,m+18);
  2429.                         end;
  2430.                     80    :    begin
  2431.                         _setcolor(0);
  2432.             _rectangle(_gfillinterior ,152 ,m+2 ,178 ,m+18);
  2433.                         if choice<5 then begin
  2434.                         m:=m+35;
  2435.                         choice:=choice+1;
  2436.                             end
  2437.                         else begin
  2438.                         m:=m-35*4;
  2439.                         choice:=1;
  2440.                             end;
  2441.                         _setcolor(12);
  2442.             _rectangle(_gfillinterior ,152 ,m+2 ,178 ,m+18);
  2443.                         end;
  2444.                     13    :    begin
  2445.                         enter:=false;
  2446.                         if choice=1 then introduce
  2447.                         else if choice=2 then begin
  2448.                             a:=_setvideomode(_defaultmode);
  2449.                             gamecode(die);
  2450.                             end
  2451.                         else if choice=3 then option
  2452.                         else if choice=4 then begin
  2453.                             start;
  2454.                             end
  2455.                         else again:=false;
  2456.                         end;
  2457.                     end;
  2458.                 end;
  2459.             until not(enter);
  2460.           until not(again);
  2461.       end;
  2462.  
  2463. {main}
  2464. begin
  2465.     initialize;
  2466.     readcode;
  2467.     entergame;
  2468.     menu(exit);
  2469.     a:=_setvideomode(_defaultmode);
  2470. end.
  2471.